Example of calling POST request
//next example will insert new conversation
$service_url = 'http://example.com/api/conversations';
$curl = curl_init($service_url);
$curl_post_data = array(
'message' => 'test message',
'useridentifier' => 'agent@example.com',
'department' => 'departmentId001',
'subject' => 'My first conversation',
'recipient' => 'recipient@example.com',
'apikey' => 'key001'
);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
$curl_response = curl_exec($curl);
if ($curl_response === false) {
$info = curl_getinfo($curl);
curl_close($curl);
die('error occured during curl exec. Additioanl info: ' . var_export($info));
}
curl_close($curl);
$decoded = json_decode($curl_response);
if (isset($decoded->response->status) && $decoded->response->status == 'ERROR') {
die('error occured: ' . $decoded->response->errormessage);
}
echo 'response ok!';
var_export($decoded->response);
https://ourwebsite.com/support/api/index.php?handler=conversations
message=[PLAN_NAME]
useridentifier=email@ourwebsite.com
subject=oursubject
department=Department001
recipient=[EMAIL]
do_not_send_mail=Y
apikey=xxxxxxx
Please Log in to join the conversation.
http://example.com/api/conversations
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.