Rest API passing list array

i cant figure this out,
1 - I have a Json Call that creates a Sales Order with multiple items structured that works on the API connector screen

{
“OrderNbr”: {
“value”: “” },
“OrderType”: {
“value”: “SO”},
“CustomerID”: {
“value”: “XXXXXXX”},
“CustomerOrder”: {
“value”: “STG21002”},
“Details”: [
{ “InventoryID”: {
“value”: “MON101ESS” },
“OrderQty”: {
“value”: “16.0000”}
},
{ “InventoryID”: {
“value”: “MON102ESS”},
“OrderQty”: {
“value”: “16.0000” }
}
]
}
2 - I can set up a Body (JSON object, use <> for dynamic values) and plug in the values directly on the variable screen and the call works.
{
“OrderNbr”: {
“value”: “” },
“OrderType”: {
“value”: “SO”},
“CustomerID”: {
“value”: “XXXXXXX”},
“CustomerOrder”: {
“value”: “STG21002”},
“Details”: [

]
}

3 - I have managed to create the list of items using the format as text function to pass in to the variable but that does not work even if a save the values from the list on to a custom state to the be used on the call
image

Copy the values formatted as text on to the custom state

Response whey the put call is made using the intentory posted from the formatted as text

image

Any Ideas ???

There was another post recently that said the linebreaks in the :format as text were causing them issues, maybe try typing it all out without any extra newlines and spaces? Notice in the API connector manually typing it its forced into a single line.

Hi Roger! I suggest removing the quotes around < OrderNbr >, < CustomerID >, and < CustomerOrd >. I had a similar issue before, and removing the quotes solved it. It might seem odd, but many JSON problems are caused by these types of issues.

Best,
Artem

1 Like

Thank you all for your time,
as @tylerboodman mentioned the array coming from the :format as text does cause issues if there are ANY spaces or line breaks on the structure of the array. i went back and made the call all one line without any spaces and this worked like a charm.

Love Bubble hahaha

2 Likes