# Calling API from script using node

**URL:** <https://community.dreamfactory.com/t/calling-api-from-script-using-node/3198>\
**Category:** Server-Side Scripting\
**Created:** [September 8, 2016, 7:47pm UTC](https://community.dreamfactory.com/t/calling-api-from-script-using-node/3198 "2016-09-08T19:47:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinod\_Hum](https://avatars.discourse-cdn.com/v4/letter/v/6f9a4e/32.png) [@Vinod\_Hum](https://community.dreamfactory.com/u/Vinod_Hum)\
**Post date:** [September 8, 2016, 7:47pm UTC](https://community.dreamfactory.com/t/calling-api-from-script-using-node/3198/1 "2016-09-08T19:47:00Z")

</div>

Hi,  
how to call post api from script using node.  
below code is give me \> 400 Bad Request

```
           platform.api.post("mysql/_table/employee",{"resource": [payload]}, '', function(body, response){
                    console.log(response.statusCode + " " + response.statusMessage);
                    event.setResponse(JSON.parse(body), response.statusCode, 'applicaton/json');
                });

```

any idea how to call api from script and what am I doing wrong ?

---

<div class="post-metadata">

**Author:** ![Vinod\_Hum](https://avatars.discourse-cdn.com/v4/letter/v/6f9a4e/32.png) [@Vinod\_Hum](https://community.dreamfactory.com/u/Vinod_Hum)\
**Post date:** [September 11, 2016, 2:48am UTC](https://community.dreamfactory.com/t/calling-api-from-script-using-node/3198/2 "2016-09-11T02:48:53Z")

</div>

any know how to call api from node event scripit ?  
example for df wiki is notworking  
Thanx

---

<div class="post-metadata">

**Author:** ![Erik\_Jacobsen](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/erik_jacobsen/32/1132_2.png) [@Erik\_Jacobsen](https://community.dreamfactory.com/u/Erik_Jacobsen)\
**Post date:** [May 25, 2018, 2:28pm UTC](https://community.dreamfactory.com/t/calling-api-from-script-using-node/3198/3 "2018-05-25T14:28:14Z")

</div>

@Vinod_Hum

You do have a typo in your code:

`event.setResponse(JSON.parse(body), response.statusCode, 'applicaton/json');`

It should be:

`event.setResponse(JSON.parse(body), response.statusCode, 'application/json');`

You forgot an “i” in application.
