Passing a list object as body param in a POST HTTP request

I’m trying to pass an object(like below) as a POST request body param, I’m unable to do so, would someone be able to help me here?

{'CartItem': {'GroupId': Group, 'quantity': quantity}}
1 Like

Hi @nixonsam, first of all welcome to the community :tada:

You should be able to pass on any JSON structure when enabling the JSON/RAW Parameters option of the HTTP Request node (I assume that’s the one you have in mind):

You can then add any valid JSON object in the Body Parameters field:

{"CartItem": {"GroupId": "Foo", "quantity": 123}}

This would also work for lists of multiple items like so:

[{"CartItem": {"GroupId": "Foo", "quantity": 123}},
{"CartItem": {"GroupId": "Bar", "quantity": 456}}]

Is this what you were looking for? If not, could you share a link to the documentation of the API you are calling?

2 Likes

@MutedJam Thanks a lot for your help! It worked, however, I’m getting a different error now:

ERROR: Cannot create property 'accept' on string '{'Content-Type': 'application/json', 'Accept': 'application/json'}'

defining the header like below solved it

{{ {'Content-Type': 'application/json', 'Accept': 'application/json'} }}
1 Like

Awesome, glad to hear you figured it out, thanks so much for confirming!