# JSON REST API Call in POST CALL returns 400 with module

**URL:** <https://community.make.com/t/json-rest-api-call-in-post-call-returns-400-with-module/56302>\
**Category:** Questions\
**Created:** [September 27, 2024, 10:08am UTC](https://community.make.com/t/json-rest-api-call-in-post-call-returns-400-with-module/56302 "2024-09-27T10:08:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juraj\_Puchky](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/juraj_puchky/32/50304_2.png) [@Juraj\_Puchky](https://community.make.com/u/Juraj_Puchky)\
**Post date:** [September 27, 2024, 10:08am UTC](https://community.make.com/t/json-rest-api-call-in-post-call-returns-400-with-module/56302/1 "2024-09-27T10:08:11Z")

</div>

Hi,

i have created module to send JSON REST POST request in my custom app but it always return 400. Suggesting that data are wrongly propagated i have only one bundle.

[  
{  
“mode”: “High”,  
“tone”: “Casual”,  
“prompt”: “this is robot text”,  
“business”: false,  
“rephrase”: true  
}  
]

and module contains following settings

“method”: “POST”,  
“headers”: {  
“api-token”: “{{connection.apiKey}}”,  
“Content-Type”: “application/json”  
},  
“qs”: {},  
“body”: {  
“prompt”: “{{createJSON(parameters.prompt)}}”,  
“rephrase”: “{{parameters.rephrase}}”,  
“tone”: “{{createJSON(parameters.tone)}}”,  
“mode”: “{{createJSON(parameters.mode)}}”,  
“business”: “{{parameters.business}}”  
},  
“response”: {  
“output”: “{{parseJSON(body.result)}}”  
}

any suggestion?

---

<div class="post-metadata">

**Author:** ![api-guy](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@api-guy](https://community.make.com/u/api-guy)\
**Post date:** [September 27, 2024, 4:52pm UTC](https://community.make.com/t/json-rest-api-call-in-post-call-returns-400-with-module/56302/2 "2024-09-27T16:52:46Z")

</div>

The prompt creating json is odd. Are you having AI format the JSON body for the request? I suggest swapping your destination URL for something like a test URL (hookrelay, etc) to see what is actually being sent.

---

<div class="post-metadata">

**Author:** ![api-guy](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@api-guy](https://community.make.com/u/api-guy)\
**Post date:** [September 27, 2024, 6:50pm UTC](https://community.make.com/t/json-rest-api-call-in-post-call-returns-400-with-module/56302/3 "2024-09-27T18:50:48Z")

</div>

In the custom functions, the `JSON.stringify()` or `JSON.parse()` functions should be used instead of `createJSON()` or `parseJSON()` .

> **[JavaScript in Make | Make Apps](https://docs.make.com/apps/app-components/iml)**

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/make/original/1X/9786f7887a39f4a0fef4d09346ab5b54ce20222b.svg) [@system](https://community.make.com/u/system)\
**Post date:** [October 27, 2024, 6:51pm UTC](https://community.make.com/t/json-rest-api-call-in-post-call-returns-400-with-module/56302/4 "2024-10-27T18:51:36Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
