Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

REST Endpoint Task: not able pass JSON as input payload to POST request body

I am trying to make a simple POST request with message body payload as JSON object.

This doesn't work.  The endpoint is rejecting my request because it is expecting a JSON object whereas it is getting a string.

I have specified content-type header as application/json.  requestBody is from a variable of type JSON.

Please suggest the next steps...

Solved Solved
0 5 572
1 ACCEPTED SOLUTION

Hi msaxena,

Thanks for reaching out. Regarding the request body payload, what does your string request payload look like? In particular, you don't have to manually include the escapes in the string. For example, assuming your json is {"name": "John"}, you want to simply provide the string name as is. Below is an example of defining a string variable used as the REST request body. Can you give it a try? Please let us know if this still doesn't work. In that case, please let us know how you set your string value, so we can help.

Thanks!

 

zhuht_0-1718660127244.png

View solution in original post

5 REPLIES 5

Hi msaxena,

Thanks for reaching out. Regarding the request body payload, what does your string request payload look like? In particular, you don't have to manually include the escapes in the string. For example, assuming your json is {"name": "John"}, you want to simply provide the string name as is. Below is an example of defining a string variable used as the REST request body. Can you give it a try? Please let us know if this still doesn't work. In that case, please let us know how you set your string value, so we can help.

Thanks!

 

zhuht_0-1718660127244.png

Thank you so much for your response.  I created a new Integration and it worked.  

When I went back to previous version, it didn't work.  So I downloaded the Integration for the version that worked and the one that didn't, and they are same except one change.  The version that didn't work has an additional attribute: 

"lockHolder": "myemail",

What if the json in the request body payload is dynamic and don't have a default value? any workaround? @zhuht 

Were you able to find the answer for how to add dynamic values in request payload ?

I saw you asked your question in a new thread and I answered there.

I agree though, that it should be easier to discover this stuff. 

Top Labels in this Space