Alert Transport API

I am having some issues using the alert transport feature. The API I am trying to use requires a unique session-token each call. The session-token is given but how can I place the session token and run a new API in the same transport? The url’s seem to be different as well. http://IP/apirest.php/initsession will give you the session code however I need to post into the http://IP/apirest.php/ticket section. Any help would be greatly appreciated. Trying to post tickets to GLPI using GLPI’s API.

I think I need to do something like this:

$api_url=“http://localhost/glpi_pcpa/apirest.php”;
$app_token=“qHGjkP5EZ72al2uH0kANxrVk8iTY6L0hW6I6LwaZ”;
$user_token = “9paN3NW7bfDeGfVplYN01xKi6Qhy5sD2wG5cQIWq”;
$ch = curl_init();
$url=$api_url . “/initSession?Content-Type=%20application/json&App_Token=”.$app_token.“&user_token=”.$user_token;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
curl_close ($ch);
$obj = json_decode($json,true); //{“session_token”:“qjr28v40kb88tucrpli2n0nupt”}

$sess_token = $obj['session_token'];

And call $sess_token in the head of the API section.

Just wanted to bump this to see if anyone had any thoughts!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.