# Set headers explicitly?

**URL:** <https://community.dreamfactory.com/t/set-headers-explicitly/2453>\
**Category:** Server-Side Scripting\
**Created:** [April 1, 2016, 11:00am UTC](https://community.dreamfactory.com/t/set-headers-explicitly/2453 "2016-04-01T11:00:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![m\_menon](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@m\_menon](https://community.dreamfactory.com/u/m_menon)\
**Post date:** [April 1, 2016, 11:00am UTC](https://community.dreamfactory.com/t/set-headers-explicitly/2453/1 "2016-04-01T11:00:34Z")

</div>

hi,

When making API calls from scripts, is it a good practice to set headers explicitly? If yes then what headers are most appropriate and needed for making calls to DF API? Like for the example below, what headers are necessary?

```
var options = {
    "CURLOPT_HTTPHEADER": ["Content-type: application/json", "Some-Other-Header: blah"]
};
 
result = platform.api.post("http://example.com/my_api", {"name":"test"}, options);

```

And a small doubt, when I print the result of an API call I see the following text  
`{"status_code":200,"content":{"resource":[{"_id":"56fe51047d57d001183c987a"}]},"content_type":null,"format":201}`

Why is the content\_type set to null? 🤔

Cheers,  
M.M

---

<div class="post-metadata">

**Author:** ![andersonmuller](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@andersonmuller](https://community.dreamfactory.com/u/andersonmuller)\
**Post date:** [April 5, 2016, 9:05pm UTC](https://community.dreamfactory.com/t/set-headers-explicitly/2453/2 "2016-04-05T21:05:52Z")

</div>

Hi @m_menon,

Its ok and useful in some cases, but, if you create a service inside DF and need to call this service, you dont need to set headers and also dont need use your full URL. Just call like this:

> result = platform.api.post(“my\_service\_name”, {“name”:“test”});

The content type in your header, tells what you are sending and not what you will receive. Maybe your “[http://example.com/my\_api](http://example.com/my_api)” doesn’t set the content-type, so the content\_type is set to null by DF.

---

<div class="post-metadata">

**Author:** ![m\_menon](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@m\_menon](https://community.dreamfactory.com/u/m_menon)\
**Post date:** [April 6, 2016, 3:03am UTC](https://community.dreamfactory.com/t/set-headers-explicitly/2453/3 "2016-04-06T03:03:40Z")

</div>

hi Anderson,

Alrightey thanks…that clears it up 🙂

Cheers,  
M&M
