Zoho Book Contacts API issue

Zoho Book Contacts API issue

Hi, I am trying to create contacts through the "https://books.zoho.com/api/v3/contacts" API,

I have tried following code but it is always returning invalid auth token, or invalid JSONString or you are not authorized etc. Not sure what is going wrong

Here is code for simple raw post message generated through postman

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{\'authtoken\':"1000.f103c17ac631e5980a581e6f339e34b8.74368abf5fe03e42c75519fe3068d490",\'JSONString\':\'{"contact_name":"A G ENTERPRISES","company_name":"A G ENTERPRISES","website":"","language_code":"en","contact_type":"customer","customer_sub_type":"business","credit_limit":30,"opening_balance_amount":0,"gst_treatment":"business_gst","note":"Exported from ExpandX ERP","gst":"","shipping_address":{"attention":"A G ENTERPRISES","address":"4-7-236, OPP. SUNDAY MARKET NTPC JYOTHINAGAR, (M) RAMAGUNDAM, DIST. KARIMNAGAR - 505215 (T.S.)","state_code":"Andh","country_code":"IN","city":"KARIMNAGAR","zip":"505215"},"billing_address":{"attention":"A G ENTERPRISES","address":"4-7-236, OPP. SUNDAY MARKET NTPC JYOTHINAGAR, (M) RAMAGUNDAM, DIST. KARIMNAGAR - 505215 (T.S.)","state_code":"Andh","country_code":"IN","city":"KARIMNAGAR","zip":"505215"},"contact_persons":[{"salutation":"","first_name":"MR. MOHD CHAND PASHA","email":"ag.adasdad@gmail.com","mobile":"919912411588","phone":"","designation":""}]}\',\'organization_id\':\'60016783635\'}',
CURLOPT_HTTPHEADER => array(
'Content-Type: text/plain',
'Cookie: JSESSIONID=616041AF2832144611CA4B7F382D46D5; _zcsr_tmp=21d6c607-e43c-49dc-8287-848e5db43d04; ba05f91d88=200c3b2347209fe33d011f18576361ce; zbcscook=21d6c607-e43c-49dc-8287-848e5db43d04'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

This says invalid auth toekn, no matter whatever number of times I generated it

Following is another way I tried

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://books.zoho.com/api/v3/contacts', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => 'authtoken=1000.f103c17ac631e5980a581e6f339e34b8.74368abf5fe03e42c75519fe3068d490&JSONString=%7B%22contact_name%22%3A%22A%20G%20ENTERPRISES%22%2C%22company_name%22%3A%22A%20G%20ENTERPRISES%22%2C%22website%22%3A%22%22%2C%22language_code%22%3A%22en%22%2C%22contact_type%22%3A%22customer%22%2C%22customer_sub_type%22%3A%22business%22%2C%22credit_limit%22%3A30%2C%22opening_balance_amount%22%3A0%2C%22gst_treatment%22%3A%22business_gst%22%2C%22note%22%3A%22Exported%20from%20ExpandX%20ERP%22%2C%22gst%22%3A%22%22%2C%22shipping_address%22%3A%7B%22attention%22%3A%22A%20G%20ENTERPRISES%22%2C%22address%22%3A%224-7-236%2C%20OPP.%20SUNDAY%20MARKET%20NTPC%20JYOTHINAGAR%2C%20(M)%20RAMAGUNDAM%2C%20DIST.%20KARIMNAGAR%20-%20505215%20(T.S.)%22%2C%22state_code%22%3A%22Andh%22%2C%22country_code%22%3A%22IN%22%2C%22city%22%3A%22KARIMNAGAR%22%2C%22zip%22%3A%22505215%22%7D%2C%22billing_address%22%3A%7B%22attention%22%3A%22A%20G%20ENTERPRISES%22%2C%22address%22%3A%224-7-236%2C%20OPP.%20SUNDAY%20MARKET%20NTPC%20JYOTHINAGAR%2C%20(M)%20RAMAGUNDAM%2C%20DIST.%20KARIMNAGAR%20-%20505215%20(T.S.)%22%2C%22state_code%22%3A%22Andh%22%2C%22country_code%22%3A%22IN%22%2C%22city%22%3A%22KARIMNAGAR%22%2C%22zip%22%3A%22505215%22%7D%2C%22contact_persons%22%3A%5B%7B%22salutation%22%3A%22%22%2C%22first_name%22%3A%22MR.%20MOHD%20CHAND%20PASHA%22%2C%22email%22%3A%22ag.adasds%40gmail.com%22%2C%22mobile%22%3A%22919912411588%22%2C%22phone%22%3A%22%22%2C%22designation%22%3A%22%22%7D%5D%7D&organization_id=60016783635', CURLOPT_HTTPHEADER => array( 'Content-Type: application/x-www-form-urlencoded', 'Cookie: JSESSIONID=616041AF2832144611CA4B7F382D46D5; _zcsr_tmp=21d6c607-e43c-49dc-8287-848e5db43d04; ba05f91d88=200c3b2347209fe33d011f18576361ce; zbcscook=21d6c607-e43c-49dc-8287-848e5db43d04' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;

Still the response is same as previous one.