Fail with CURL PUT call with Zoho Subscription API using PHP
Hello
I use the API provided by zoho in subscription and forms for my application. I got no problems for retreive any information and update my custormer data in Zoho Books but unfortunatly, that' not working for subscription.
This is my json array to update a subscription with a new addon
- {
- "reference_id": "",
- "plan": {
- "plan_code": "MyDWS-FR-Basic",
- "name": "Abonnement de base",
- "price": 0,
- "quantity": 1,
- "tax_id": "",
- "setup_fee_tax_id": ""
- },
- "addons": [{
- "addon_code": "ADD_EN-Others1",
- "price": 0,
- "quantity": 1,
- "tax_id": ""
- }],
- "contactpersons": [{
- "contactperson_id": "264809000000126115"
- }]
- }
This is my call in my PHP app
public function makePuTCurlQuery($query,$data){
$curl = curl_init($query);
curl_setopt_array($curl, array(
CURLOPT_POST => 1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => $data,
CURLOPT_RETURNTRANSFER => true
));
$response = curl_exec($curl);
curl_close($ch);
return $response;
}
Content of my variables :
$data >
| array(3) { |
| ["authtoken"]=> |
| string(32) "my_working_authtoken" |
| ["organization_id"]=> |
| string(9) "my_working_organization_id" |
| ["JSONString"]=> |
| string(281) "{"reference_id":"","plan":{"plan_code":"MyDWS-FR-Basic","name":"Abonnement de base","price":0,"quantity":1,"tax_id":"","setup_fee_tax_id":""},"addons":[{"addon_code":"ADD_EN-Others1","price":0,"quantity":1,"tax_id":""}],"contactpersons":[{"contactperson_id":"264809000000126115"}]}" |
| } |
This is the result of the call with any others explaination > "The request passed is not valid."
Where i did a mistake ? This kind of call working like a charm for Books...
Cheers
Sébastien