# POST API integration is not working

**URL:** <https://forum.inductiveautomation.com/t/post-api-integration-is-not-working/84017>\
**Category:** Ignition\
**Created:** [January 10, 2024, 5:41am UTC](https://forum.inductiveautomation.com/t/post-api-integration-is-not-working/84017 "2024-01-10T05:41:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nilesh\_M](https://avatars.discourse-cdn.com/v4/letter/n/a88e4f/32.png) [@Nilesh\_M](https://forum.inductiveautomation.com/u/Nilesh_M)\
**Post date:** [January 10, 2024, 5:41am UTC](https://forum.inductiveautomation.com/t/post-api-integration-is-not-working/84017/1 "2024-01-10T05:41:58Z")

</div>

Hello, I am new to ignition.  
I am trying to integrate the POST API but it is not working. This API is working fine in POSTMAN.  
I want to pass the header values for authentication, but it was passing it as parameter. I don't want to pass it as parameter. I want to pass the header values.  
Code:

```auto
def test_1():
    url = " **************************"
    postParams = {
            "ORGANIZATION_CODE": "**"
        }
        
    header_Values = {
        'client_id': ' *******',
        'client_secret': ' *******'
        }
        
    page = system.net.httpPost(url, postData= postParams, headerValues=header_Values )
    print page

```

Error :  
IOError: Server returned HTTP response code: 500 for URL

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Mariano\_Alvarez](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mariano_alvarez/32/35283_2.png) [@Mariano\_Alvarez](https://forum.inductiveautomation.com/u/Mariano_Alvarez)\
**Post date:** [January 10, 2024, 11:07am UTC](https://forum.inductiveautomation.com/t/post-api-integration-is-not-working/84017/2 "2024-01-10T11:07:05Z")

</div>

Try setting the content type as JSON and encoding the params in json

```auto
    url = " **************************"
    postParams = {
        "ORGANIZATION_CODE": "**"
    }
    
    postParamsEnc = system.util.jsonEncode(postParams)
    
    header_Values = {
        'client_id': ' *******',
        'client_secret': ' *******',
        'Content-Type': 'application/json'  
    }
    
    page = system.net.httpPost(url, postData= postParamsEnc, headerValues=header_Values )
    print (page)

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 10, 2024, 5:01pm UTC](https://forum.inductiveautomation.com/t/post-api-integration-is-not-working/84017/3 "2024-01-10T17:01:27Z")

</div>

Use system.net.httpClient, not httpPost.
