Can someone please help me with creating a Sales Order using API? I can provide code and response. I tried a lot of things but nothing works for me.
Thank you!
Code:
$access_token = access_token_value();
$data = array(
"customer_id" => "1481060XXXXXXXXXXXXX",
"salesorder_number" => "026986",
"date" => "2021-09-27",
"delivery_method" => "free_shipping",
"line_items" => array(
"item_id" => "272000000247",
"rate" => "112",
"quantity" => "2"
)
);
//$data_string = "JSONString=".urlencode(json_encode($data));
echo "<br><br>".json_encode($data)."<br><br>";
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, "https://inventory.zoho.com/api/v1/salesorders?organization_id=XXXXXXXX");
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_HTTPHEADER, array (
'Authorization: Zoho-oauthtoken ' . $access_token,
));
$response = curl_exec($ch);
$response=json_decode($response);
var_dump($response);