Hello,
I'm integrating Zoho into our inhouse application, but I'm experiencing some issues with posting to the API.
All of them being related to JSONString is invalid. And I don't seem to find a solution.
Is there an online JSONString validator?
My JSONString for creating a new contact:
"JSONString" => "{"customer_name":"9a52ef41-df2b-42e9-ad8f-383f03208878","billing_address":{"address":"Foo 21","street2":"","city":"Palma","state":"Palma","zip":"77010","country":"Spain","phone":"099 999 999 999"},"contact_persons":{"email":"john@example.com","phone":"099 999 999 999"}}"
And this is the code calling the API.
public function request($url, $method = 'GET', $data = null)
{
$options = [
'query' => [
'authtoken' => $this->token,
'organization_id' => $this->organization,
],
];
if (! is_null($data)) {
$options['headers'] = [
'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8',
];
$options['form_params'] = [
'JSONString' => json_encode($data),
];
}
try {
$request = $this->client->request($method, $this->api_url.$url, $options);
return json_decode($request->getBody()->getContents(), true);
} catch (Exception $exception) {
throw $exception;
}
}