You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

rest chat api error

Accepted answer
48
Views
2
Comments
edited Jun 8, 2022 12:10PM in General Technical Discussions 2 comments

Summary

its giving internal error please help me fix it

Code Snippet

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://xxxxxx/services/rest/crossChannelServices/v1.4/establishSessions',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "sessionInformation": "{\\"emailAddress\\":\\"[email protected]\\", \\"firstName\\":\\"Ruman\\", \\"lastName\\":\\"Nisar\\", \\"question\\":\\"Test Chat\\", \\"auxiliaryData\\": {\\"BROWSER\\":\\"Firefox\\", \\"OPERATING_SYSTEM\\":\\"iPhone OS\\", \\"USER_AGENT\\":\\"Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1\\"}}"
}',
  CURLOPT_HTTPHEADER => array(
    'OSvC-CREST-Application-Context: chat-api',
    'Authorization: Basic ',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!