I am very new to the Zoho API as well as curl. I am trying to develop a class that is able to create estimates for customers using the Zoho Books API, but when I run my code I keep getting a boolean false response >>. Please tell me what i'm doing wrong, and also direct me to a site with proper tutorials for this.
$data = array(
'authtoken' => 'xxxxxxxxxx',
'JSONString' => '{
"customer_id": "157691000000041090",
"contact_persons": [
"157691000000041090"
],
"template_id": "157691000000041077",
"estimate_number": "EST-000001",
"reference_number": "QRT-123456",
"date": "2015-08-25",
"expiry_date": "2015-08-27"
"exchange_rate": 1.0,
"discount": 0.0,
"is_discount_before_tax": true,
"discount_type": "item_level",
"salesperson_name": "John Michael",
"is_inclusive_tax": "false",
"custom_fields": [
{
"index": 1,
"value": "25 Aug 2015"
}
],
"line_items": [
{
"item_id": "157691000000041080",
"name": "Book1",
"description": "book",
"rate": 50.00,
"item_order": 0,
"quantity": 1.0,
"discount": 0.0,
"tax_id": "",
}
],
"notes": "Looking forward for your business.",
"terms": "Terms and conditions apply.",
"shipping_charge": 0.0,
"adjustment": 0.0,
"adjustment_description": "Adjustment"
}',
"organization_id" => '57408606'
);
$curl = curl_init($url);
curl_setopt_array($curl, array(
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $data,
CURLOPT_RETURNTRANSFER => true
));
$estimate = curl_exec($curl);
var_dump($estimate)
It looks like the JSON is not well formatted. Please do the following changes and let me know if it works
1) add "," after
"expiry_date": "2015-08-27"
2) remove "," after
"tax_id": "",