I am integrating service desk through API in an already build application where logged in user can create a request using “Create Customer Request API (raiseOnBehalfOf is logged in user)”. I want to make it more interactive so that logged in user can see all their requests.
This API gives me ability to get requests
https://developer.atlassian.com/cloud/jira/service-desk/rest/#api-request-get
but not really for a particular customer because request param doesn’t ask for username. Example doesn’t help much as it doesn’t use request params.
PHP code I am using :
$url = "https://url.atlassian.net/rest/servicedeskapi/request";
$data_str = http_build_query([
"serviceDeskId" => $SERVICE_DESK_ID,
"requestTypeId" => $REQUEST_TYPE_ID,
"requestStatus" => "ALL_REQUESTS" ,
"requestOwnership" => "ORGANIZATION",
"organizationId" => $id
]);
$url .= "?".$data_str;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERPWD, $USRPWD);
$headers = [
'Accept: application/json',
//'Content-Type: application/json'
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
curl_close($ch);
$issues = json_decode($result);
print_r($issues);die();