Dynamic API

Hello Everyone,   I just got a task specifying that, the consuming REST API calls should be done using Dynamic Values from the table. which are entered in form.   As I see, we can pass Location (URL) dynamic.   But I'm stuck in how to map response to the attributes to insert data in the database?   And also how to configure when it need to be Authenticated(UserName and Password)?
2 answers

The call rest service microflow activity allows you to provide url, username, passwords via variables, so that can be done dynamically.


The response json could be stored as a string in an entity, but you need some rules/logic to map the contents to entities and attributes. You could model some mappings, and then at runtime select one of the mappings to do the actual mapping. The import mapping activity needs you the define the mapping to be used at design time, but you can build a microflow with a decision (if statement) that select the correct mapping at runtime.


This only works if you have a limited set of mappings, and you can easily determine at runtime which mapping to use per json message.




The following example shows how you can apply different mappings based on the response message received.




If everything is completely dynamic, you'll probably need some custom java actions.


You will need to extract the required data from the response and associate it with the corresponding attributes in your database, then perform the insert operation. To configure username and password authentication, you can include this information in the request header when calling the REST API. This is typically done by adding an "Authorization" header with basic authentication, where the username and password are Base64 encoded and included in the request header.