require "util/httpful.phar";
$url = "https://md5.tpondemand.com/api/v1/requests"; // Put your account API query url here.
$access_token = "MTpjR*********=="; // Access token, see My profile / Access Tokens.
$create_response = \Httpful\Request::post($url . "?access_token=$access_token")
->body('{' .
'name: "New request",' . // Request name
'project: {' .
'id: "1584"' . // Request project id
'}' .
'}')
->sendsJson()
->send();
echo "<pre>";
print_r($create_response);
Senior Customer Success Manager
UK: +44 (0)1603 618382 | US Toll Free: 1 888-528-0896 | US Local: 1 619-382-2131
--
You received this message because you are subscribed to a topic in the Google Groups "DevTargetProcess" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/devtargetprocess/hgXcN5T_IpA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to devtargetprocess+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
What I am wondering is how can I go about returning the Request ID that I just created? I can see its output in the $create_response object but it would be great to get this back in my response.
require "util/httpful.phar";
$url = "https://md5.tpondemand.com/api/v1/requests"; // Put your account API query url here.
$access_token = "MTpjR*********=="; // Access token, see My profile / Access Tokens.
$raw_response = \Httpful\Request::post($url . "?access_token=$access_token")
->body('{' .
'name: "New request 3",' .
'description: "Some description",' .
'project: {' .
'id: "1584"' .
'}' .
'}')
->sendsJson()
->send();
echo "<pre>";
$is_created = $raw_response->code >= 200 && $raw_response->code < 300;
if ($is_created) {
// Use SimpleXML module (PHP 5, PHP 7) to parse result XML.
// Can't find a way to force httpful to accept JSON as result, headers are ignored. :( $request_xml = simplexml_load_string($raw_response->body);
if ($request_xml) {
// Request created, use it.
echo 'Created request with id ' . $request_xml['Id'];
} else {
// Sanity check. TP has problems if we are here.
echo "Problems with parsing request creation response: ";
foreach(libxml_get_errors() as $error) {
echo "<br>", $error->message;
}
}
} else {
// Process request creation error.
echo 'Problems with request creation. HTTP code: ' . $raw_response->code .
'. Response body: ' . $raw_response->body;
}
The other is that when raising a request via email we get an autoresponse back, I guess this is something I need to talk to our admin about setting up an alert for if its raised by the API?
To unsubscribe from this group and all its topics, send an email to devtargetproce...@googlegroups.com.
Senior Customer Success Manager
UK: +44 (0)1603 618382 | US Toll Free: 1 888-528-0896 | US Local: 1 619-382-2131
To unsubscribe from this group and all its topics, send an email to devtargetprocess+unsubscribe@googlegroups.com.
require "util/httpful.phar";
$url = "https://md5.tpondemand.com/api/v1/requests"; // Put your account API query url here.
$access_token = "MTpjR*********=="; // Access token, see My profile / Access Tokens.
$create_response = \Httpful\Request::post($url . "?access_token=$access_token") // Add &format=json if you need json response.
->body('{' .
'name: "New request",' . // Request name
'project: {' .
'id: 1584' . // Request project id
'},' .
'priority: {' . // The priority of the request.
'id: 21' . // 'Normal' priority.
'}' .
'}')
->sendsJson()
->send();
echo "<pre>";
print_r($create_response);
Senior Customer Success Manager
UK: +44 (0)1603 618382 | US Toll Free: 1 888-528-0896 | US Local: 1 619-382-2131
--
You received this message because you are subscribed to a topic in the Google Groups "DevTargetProcess" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/devtargetprocess/hgXcN5T_IpA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to devtargetprocess+unsubscribe@googlegroups.com.
'{' .
'name: "' . $data['tpsubject'] . '",' .
'project: {id: 33086},' .
'priority: {id: 6},' .
'description: "' . $data['tpmessage'] . '"' .
'}'
To unsubscribe from this group and all its topics, send an email to devtargetproce...@googlegroups.com.
Senior Customer Success Manager
UK: +44 (0)1603 618382 | US Toll Free: 1 888-528-0896 | US Local: 1 619-382-2131
To unsubscribe from this group and all its topics, send an email to devtargetprocess+unsubscribe@googlegroups.com.