"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;
}
}
Writer is a powerful online word processor, designed for collaborative work.