Create an unique list from an API response

0
Hi All,  I'm wanting to create a list populated by an API service. In order to do so, I need some of the fields which are not direct children of the main entity. I'm attaching my json response for you to see the fields that I need to have in my list. I'm needing description, externalId and the offering. By mapping my json response I'm able to access to description, id, etc kind of values, but I cannot access to the others as externalId, Offerings, etc. Is there a way to achieve this?  I tried to create an unique list but I can only access to direct children of the main entity and not the others. The JSON response is the following. {     "users": [         {             "id": "7191e8a8-af2d-11e7-abc4-cec278b6b50a",             "description": "exampleUser01",             "parentUserId": "7191e628-af2d-11e7-abc4-cec278b6b50a",             "parentBusinessUserId": "7191f082-af2d-11e7-abc4-cec278b6b50a",             "visibilityGrantId": 1,             "status": "active",             "role": "enterpriseOperator",             "defaultLanguage": "IT",             "externalIds": [                 {                     "externalId": "user@email.it",                     "defaultFlag": "true",                     "type": "primaryExternal"                 }             ],             "attributes": [                 {                     "attributeName": "mobile",                     "attributeValue": "34512312432",                     "attributeLanguage": "it"                 },                 {                     "attributeName": "name",                     "attributeValue": "Bob",                     "attributeLanguage": "any"                 },                 {                     "attributeName": "surname",                     "attributeValue": "Doe",                     "attributeLanguage": "any"                 }             ],             "socialAttributes": [                 {                     "attributeName": "attr1",                     "attributeValue": "value1",                     "socialId": "Facebook"                 }             ],             "offerings": [                 {                     "offering": "ConnectedCommerce",                     "capabilities": [                         {                             "name": "Gamification"                         },                         {                             "name": "Core"                         }                     ]                 }             ],             "creationDate": "2017-09-22T16:00:12.0000000+02:00",             "updatedDate": "2017-11-22T15:04:12.0000000+01:00"         }     ] }
asked
6 answers
0

Not really sure what you mean, but i guess this has something to do with arrays. For example externalIds wil return a list on his own because this is an array. Not only one externalId.

 "externalIds": [
                {
                    "externalId": "user@email.it",
                    "defaultFlag": "true",
                    "type": "primaryExternal"
                }
            ],

answered
0

Yes, that's true. It will generate an array but this is not my direct problem. I mean what I need is a unique entity to have both values from the "main" array (the one containing id, businessUserId, description, etc.) and from the internalIds ones. I was wondering if there's a correct way to do so. 

I was also trying to create two separate lists and then merge them, but, once again I was not able to have the complete set of data that I need. 

answered
0

Create an extra entity with all the values in it you want. Then you have to map the json first as is. And after the mapping in a microflow you can set a the attributes you want in the extra microflow. You should loop through the arrays. 

There is no way you can do this directly in the import mapping. 

answered
0

Hi Sander. Thank you very much, May I ask you: taking the entire response I posted in my first message, what would you put in the main Entity data set and what would you consider an additional array? 

Once I've created the two entities, how can I link them together in order to display them as a single entity in my page? 

answered
0

What i would do is let Studio Pro create the entities for the json for you. This can be done via the map automatically button. Then you dont have to link them yourself.

 

Maybe its a good idea to foloow the learning path about import mappings. This kind of things are handled in there if i remember correctly. 

answered
0

Do you mean the following link?

https://gettingstarted.mendixcloud.com/link/path/44

answered