PHP Create Request v3 API Issue
I'm guessing I am missing something simple. Can can't seem to get my sample code to create a new request.
The code:
$payload = '
{
"request": {
"subject": "API Test Ticket",
"description": "Some sample JSON to test v3 API",
"requester": {
"email_id": "bbunny@amce.com"
}
}
}
';
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Accept: application/vnd.manageengine.sdp.v3+json',
'TECHNICIAN_KEY: '.$srAPI_key));
curl_setopt($ch, CURLOPT_URL,"https://sdp.acme.com/api/v3/requests");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
$server_output = curl_exec ($ch);
$error_message = curl_errno($ch);
curl_close ($ch);
return $server_output;
The response:
{
"response_status":{
"status_code":4000,
"status":"failed",
"messages":[
{
"status_code":4004,
"message":"Internal Error",
"type":"failed"
}
]
}
}
Any thoughts?
New to ADSelfService Plus?