Facing zoho inventory rest api issue.
Dear sir/madam,
I am using the
zoho inventory rest api. please check and suggest me as soon as possible.
Url : '
https://inventory.zoho.com/api/v1/purchaseorders?ignore_auto_number_generation=0?authtoken=f8d6e09ef3d90a4323f96aac7b2a667c&organization_id=647725867';
Request : data_json = '{
"purchaseorder_number": "PO-00002",
"date": "2015-05-28T00:00:00.000Z",
"delivery_date": "2015-06-01T00:00:00.000Z",
"reference_number": "REF-P-00002",
"ship_via": "FedEx",
"vendor_id": 4815000000044080,
"salesorder_id": 4815000000044936,
"is_drop_shipment": true,
"is_inclusive_tax": false,
"is_backorder": false,
"template_id": 4815000000017003,
"contact_persons": [
"460000000026051"
],
"attention": "Tony",
"delivery_org_address_id": 4815000000044077,
"delivery_customer_id": 4815000000044066,
"notes": "Sample Note",
"terms": "Terms and Conditions",
"exchange_rate": 1,
"line_items": [
{
"item_id": 4815000000044100,
"line_item_id": 4815000000044897,
"purchaseorder_item_id": 4815000000044892,
"account_id": 4815000000035003,
"name": "Laptop-white/15inch/dell",
"description": "Just a sample description.",
"item_order": 0,
"bcy_rate": 122,
"purchase_rate": 122,
"quantity": 2,
"quantity_received": 2,
"unit": "qty",
"item_total": 244,
"tax_id": 4815000000044043,
"tax_name": "Sales Tax",
"tax_type": "tax",
"tax_percentage": 12,
"image_id": 2077500000000002000,
"image_name": "dell.jpg",
"image_type": "jpg"
}
],
"documents": [
{
"can_send_in_mail": true,
"file_name": "sample.pdf",
"file_type": "pdf",
"file_size_formatted": "116.8 KB",
"attachment_order": 1,
"document_id": 16115000000096068,
"file_size": 11957
}
]
}';
$data_json = json_decode($data_json);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($data_json));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
Response : {"code":4,"message":"Invalid value passed for JSONString"}