Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get approver decision via REST API for all issues in queue

Rob Raftery
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 30, 2022

Is it possible to get a list of approver decisions for all issues in queue via a single REAT API?  I can see the list of approvers using Get Issues in Queue (GET /rest/servicedeskapi/servicedesk/{serviceDeskId}/queue/{queueId}/issue) but I can't see who actually approved each request.

I am able to get the approver decisions using Get Approvals (GET /rest/servicedeskapi/request/{issueIdOrKey}/approval) but I would have to call that API for each issue.

I was hoping I could see the approvers for each issue in 1 API call.

Any thoughts?

1 answer

1 accepted

1 vote
Answer accepted
Joseph Chung Yin
Community Champion
October 30, 2022

@Rob Raftery -

Welcome to the community.  I am sure that you already know that the GET APPROVALS REST API call already returning the JSON body containing the approver information -

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-issueidorkey-approval-get

You will need to create a custom process to loop through all of your targeted issues to pass in the issue key/id.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Infrastructure Applications Team

Viasat Inc.

Rob Raftery
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 11, 2022

Joseph thank you for your reply.  I have implemented the looping mechanism to get all the approvals for each servicedesk issue.

I just found it odd that the 

Get issues in queue

GET /rest/servicedeskapi/servicedesk/{serviceDeskId}/queue/{queueId}/issue

REST API returns the list of people who can approve an issue, but didn't bother to add whether or not they actually approved the issue.

Furthermore, they didn't bother to provide a simple REST API to get the approvals for all issues similar to "Get issues in queue".  It seems crazy to me to have to loop through each issue one at a time.

In any case, thanks for your repsonse.

Rob

Joseph Chung Yin
Community Champion
November 11, 2022

@Rob Raftery -

In this case, I would recommend you to contact Atlassian Support (https://support.atlassian.com) and they may have additional insights to your updates.  Maybe your updates can be entered with their development team as a possible enhancements to their REST APIs.

Best, Joseph

Alexandra Neciov October 14, 2024

Hi Rob, Joseph

Do you know an alternative solution to GET /rest/servicedeskapi/request/{issueIdOrKey}/approval

I am trying to use it for the retrieval of all approvers, untill the ticket got to a certain status. My workflow can have more approval stages and more approvers per each, but it it enough for one of them to approve in order for the workflow to proceed

What I did observe was that the response of this API only returns one of these approvers. 

 You can observe in the picture the past approvals and the fact that the API response gives me no information about User Two or User ThreeMultiApprovalHistory.png

API response:


{
"size": 5,
"start": 0,
"limit": 50,
"isLastPage": true,
"_links": {
"base": "https://my.jira.domain",
"context": "",
"self": "https://my.jira.domain/rest/servicedeskapi/request/Rmy-762/approval"
},
"values": [
{
"id": "203",
"name": "Freigeben",
"finalDecision": "declined",
"canAnswerApproval": false,
"approvers": [
{
"approver": {
"name": "One",
"key": "JIRAUSER17700",
"emailAddress": "User.One@domain.my",
"displayName": "One, User",
"active": true,
"timeZone": "Europe/Zurimy",
"_links": {
"jiraRest": "https://my.jira.domain/rest/api/2/user?username=One",
"avatarUrls": {
"48x48": "https://my.jira.domain/secure/useravatar?avatarId=13218",
"24x24": "https://my.jira.domain/secure/useravatar?size=small&avatarId=13218",
"16x16": "https://my.jira.domain/secure/useravatar?size=xsmall&avatarId=13218",
"32x32": "https://my.jira.domain/secure/useravatar?size=medium&avatarId=13218"
},
"self": "https://my.jira.domain/rest/api/2/user?username=One"
}
},
"approverDecision": "pending"
}
],
"createdDate": {
"iso8601": "2024-05-02T09:46:28+0200",
"jira": "2024-05-02T09:46:28.724+0200",
"friendly": "02.05.2024 09:46",
"epomyMillis": 1714635988724
},
"completedDate": {
"iso8601": "2024-05-02T09:46:46+0200",
"jira": "2024-05-02T09:46:46.961+0200",
"friendly": "02.05.2024 09:46",
"epomyMillis": 1714636006961
},
"_links": {
"self": "https://my.jira.domain/rest/servicedeskapi/request/47971/approval/203"
},
"condition": {
"type": "percent",
"value": "100"
}
},
{
"id": "204",
"name": "Freigeben",
"finalDecision": "approved",
"canAnswerApproval": false,
"approvers": [
{
"approver": {
"name": "One",
"key": "JIRAUSER17700",
"emailAddress": "User.One@domain.my",
"displayName": "One, User",
"active": true,
"timeZone": "Europe/Zurimy",
"_links": {
"jiraRest": "https://my.jira.domain/rest/api/2/user?username=One",
"avatarUrls": {
"48x48": "https://my.jira.domain/secure/useravatar?avatarId=13218",
"24x24": "https://my.jira.domain/secure/useravatar?size=small&avatarId=13218",
"16x16": "https://my.jira.domain/secure/useravatar?size=xsmall&avatarId=13218",
"32x32": "https://my.jira.domain/secure/useravatar?size=medium&avatarId=13218"
},
"self": "https://my.jira.domain/rest/api/2/user?username=One"
}
},
"approverDecision": "pending"
}
],
"createdDate": {
"iso8601": "2024-05-02T09:48:04+0200",
"jira": "2024-05-02T09:48:04.827+0200",
"friendly": "02.05.2024 09:48",
"epomyMillis": 1714636084827
},
"completedDate": {
"iso8601": "2024-05-02T09:48:19+0200",
"jira": "2024-05-02T09:48:19.239+0200",
"friendly": "02.05.2024 09:48",
"epomyMillis": 1714636099239
},
"_links": {
"self": "https://my.jira.domain/rest/servicedeskapi/request/47971/approval/204"
},
"condition": {
"type": "percent",
"value": "100"
}
},
{
"id": "208",
"name": "Freigabe",
"finalDecision": "approved",
"canAnswerApproval": false,
"approvers": [
{
"approver": {
"name": "One",
"key": "JIRAUSER17700",
"emailAddress": "User.One@domain.my",
"displayName": "One, User",
"active": true,
"timeZone": "Europe/Zurimy",
"_links": {
"jiraRest": "https://my.jira.domain/rest/api/2/user?username=One",
"avatarUrls": {
"48x48": "https://my.jira.domain/secure/useravatar?avatarId=13218",
"24x24": "https://my.jira.domain/secure/useravatar?size=small&avatarId=13218",
"16x16": "https://my.jira.domain/secure/useravatar?size=xsmall&avatarId=13218",
"32x32": "https://my.jira.domain/secure/useravatar?size=medium&avatarId=13218"
},
"self": "https://my.jira.domain/rest/api/2/user?username=One"
}
},
"approverDecision": "pending"
}
],
"createdDate": {
"iso8601": "2024-05-14T10:16:39+0200",
"jira": "2024-05-14T10:16:39.639+0200",
"friendly": "14.05.2024 10:16",
"epomyMillis": 1715674599639
},
"completedDate": {
"iso8601": "2024-05-14T11:12:37+0200",
"jira": "2024-05-14T11:12:37.557+0200",
"friendly": "14.05.2024 11:12",
"epomyMillis": 1715677957557
},
"_links": {
"self": "https://my.jira.domain/rest/servicedeskapi/request/47971/approval/208"
},
"condition": {
"type": "number",
"value": "1"
}
},
{
"id": "239",
"name": "Freigabe",
"finalDecision": "approved",
"canAnswerApproval": false,
"approvers": [
{
"approver": {
"name": "One",
"key": "JIRAUSER17700",
"emailAddress": "User.One@domain.my",
"displayName": "One, User",
"active": true,
"timeZone": "Europe/Zurimy",
"_links": {
"jiraRest": "https://my.jira.domain/rest/api/2/user?username=One",
"avatarUrls": {
"48x48": "https://my.jira.domain/secure/useravatar?avatarId=13218",
"24x24": "https://my.jira.domain/secure/useravatar?size=small&avatarId=13218",
"16x16": "https://my.jira.domain/secure/useravatar?size=xsmall&avatarId=13218",
"32x32": "https://my.jira.domain/secure/useravatar?size=medium&avatarId=13218"
},
"self": "https://my.jira.domain/rest/api/2/user?username=One"
}
},
"approverDecision": "pending"
}
],
"createdDate": {
"iso8601": "2024-07-04T10:41:43+0200",
"jira": "2024-07-04T10:41:43.947+0200",
"friendly": "04.07.2024 10:41",
"epomyMillis": 1720082503947
},
"completedDate": {
"iso8601": "2024-07-04T10:46:52+0200",
"jira": "2024-07-04T10:46:52.950+0200",
"friendly": "04.07.2024 10:46",
"epomyMillis": 1720082812950
},
"_links": {
"self": "https://my.jira.domain/rest/servicedeskapi/request/47971/approval/239"
},
"condition": {
"type": "percent",
"value": "100"
}
},
{
"id": "248",
"name": "Freigabe",
"finalDecision": "approved",
"canAnswerApproval": false,
"approvers": [
{
"approver": {
"name": "One",
"key": "JIRAUSER17700",
"emailAddress": "User.One@domain.my",
"displayName": "One, User",
"active": true,
"timeZone": "Europe/Zurimy",
"_links": {
"jiraRest": "https://my.jira.domain/rest/api/2/user?username=One",
"avatarUrls": {
"48x48": "https://my.jira.domain/secure/useravatar?avatarId=13218",
"24x24": "https://my.jira.domain/secure/useravatar?size=small&avatarId=13218",
"16x16": "https://my.jira.domain/secure/useravatar?size=xsmall&avatarId=13218",
"32x32": "https://my.jira.domain/secure/useravatar?size=medium&avatarId=13218"
},
"self": "https://my.jira.domain/rest/api/2/user?username=One"
}
},
"approverDecision": "approved"
}
],
"createdDate": {
"iso8601": "2024-07-04T18:02:47+0200",
"jira": "2024-07-04T18:02:47.257+0200",
"friendly": "04.07.2024 18:02",
"epomyMillis": 1720108967257
},
"completedDate": {
"iso8601": "2024-07-24T16:15:17+0200",
"jira": "2024-07-24T16:15:17.262+0200",
"friendly": "24.07.2024 16:15",
"epomyMillis": 1721830517262
},
"_links": {
"self": "https://my.jira.domain/rest/servicedeskapi/request/47971/approval/248"
},
"condition": {
"type": "percent",
"value": "100"
}
}
]
}

Thanks in advance,

Alexandra

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events