How to pass string array in input while consuming REST API?

0
Hi, I am working on Consuming REST API. I have one api which take following json as input   { "serviceCode": "FKD", "assetName": "E48T05", "sensorNames": [ "AP", "PG", "WS", "RS", "TS" ] } For this I have created json strucutre and created export mapping out of it. I have one microflow for creating this input. I am able to set the values for “service code” and “assetName”. But not able to set this string array. I have to send these value only as it is hard-coded. How can i do it? TIA Regards, Swati.
asked
2 answers
1

If you import this json code as json structure, create a mapping on top of it, it should create a data structure like this. Your array is represented in a list of objects having a string value.

answered
1

Mendix can do the exportmapping for you. Create a messagedefinition, give it a name, select entity Sensor and save. Now click the button Generate mappings and there you go, Mendix generated your exportmapping.

NB. In your last screenshot Mendix expects a string-value, which should be surrounded by single quotes. But even adding single quotes won’t do the trick, because in that screen you are trying to change the value of the association Sensornames_RealTimeKpiInput, Appearently you are busy building the values for the object RealTimeKpiInput. You first have to add 5 activity Create Object for Sensorname (singular) and add them via association to RealTimeKpiInput.

 

answered