HowTo fetch nested objects from JSON responses?


After you have seen this HowTo video and read this article you will know how nested objects are fetched from JSON responses.

Step 01
Go to Tools on the builder menu left and click on 'Webservices'. In this HowTo we are using an existing web service definition.

Step 02
Create a new endpoint to the web service to fetch a single user object.

Step 03
Define all endpoint settings as Name, Http method, Path, etc.

Step 04
Save the endpoint.

Step 05
Run test to make a request and to get a response.

Step 06
Generate to response into a custom model definition.

Step 07
Go to Actions on the builder menu left.

Step 08
Create a new action to fetch the nested objects and to assign to your data model.

Step 09
Create a new Http request action event.

Step 10
Select the web service and endpoint to complete the request.

Step 11
Give the requested object a variable name 'As'. Please remind that the request returns a single object (User) with nested objects (Adress, Geo, and Company).

Step 12
Assign the fetched object to your data model by adding create events to the action.

Step 13
Assign all the properties of the model to the attributes from the custom model.

Step 14
All create events made and all properties from the custom model assigned to the properties in the data model? Then run the action manually.

Step 15
Turn back to your back office and check if the user object with its nested objects are fetched and assigned.

Next step:
HowTo send SMS-messages with Messagebird?

Didn’t find what you want?Ask your question on the forum!