Dynamic Input Contract

Hello everyone,

I wonder if using a dynamic Json object is possible as the Input Contract of a Data Action?
I don't want to pre-specify any keys under that Json object since they may change.
In fact I will handle it in my API controller.

Regards,

Hi ugur.bayramoglu,

You could configure the data action to have a request body of

${input.rawRequest}

That would pass along whatever was sent to the data action. Your endpoint or lambda could then sort out what to do with that object.

While it might be possible to process a dynamic object in the request template, it is likely to be quite difficult as our tooling wasn't designed for that use case.

--Jason

Hi @Jason_Mathison,
Thanks for your reply.
How should I set the Input Contract schema to send any Json object as input request parameter?
When I try to set the type as "object", it doesn't accept since there is no parameter beneath such as string, integer etc.

If you want to pass everything on with the rawRequest you can leave the input contract empty.

If I leave the input contract empty, in the Architect - Workflow when a Call Data Action block is added no option is appeared to send any input parameter to that Data Action.
Can you please help, how can I do that?

Ah, I didn't know you were wanting to pass the data in from architect. In that case that case you are probably going to want to have a single "String" input parameter that you pass an escaped JSON object.

From there you would either need to have the endpoint accept the escaped JSON, or you would need to unescape it prior to sending it. You can see an example of how to do that here:

That string substitutions in that example are pretty awful though. I expect that we will have a better solution to this soon.

--Jason

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.