Hi,
I am using Jira Restful API to get the issue status for a specific issue. the returned JSON object contains a full description if the status (Name, Icon, Description, ...).
How can I get only the StatusID to minimize the network traffic?
You can use fields property in your GET request:
{JIRA INSTANCE ADDRESS}/rest/api/latest/issue/ISSUE-1?fields=status
where ISSUE-1 is key of the issue. You will not get only status ID but something like:
{"status":{"self":"https://helpdesk.morosystems.cz/rest/api/2/status/1","description":"Issue is opened","iconUrl":"https://helpdesk.morosystems.cz/images/icons/statuses/open.png","name":"Open","id":"1","statusCategory":{"self":"https://helpdesk.morosystems.cz/rest/api/2/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"To Do"}}}}
I guess response is small enough though
Martin
Thank you for your feedback. actually this is what I am doing now but it is not efficient if you have
/rest/api/2/search?jql=project%20=%20ProjectName%20AND%20Application%20=%20ApplicationName&fields=description,issuetype,status
When you have too many results. So I was wondering how to get only the StatusID instead of StatusObject.
Thanks in advance,
Jimmy, I don't think it is possible. The only possibility is to implement custom REST API with one endpoint or I found script runner allows you to implement simple REST API endpoints:
https://scriptrunner.adaptavist.com/latest/jira/rest-endpoints.html#_configuration
It will be the same since the bottleneck is getting data from Jira REST API, so if I implemented my own REST API on top of Jira API, it will be the same since I am still requesting all the information from Jira and ignore what I do not need at my side. it will be more efficient to get what I need only from Jira and not everything.
Do you have any other ideas?
You've misunderstood what the REST endpoint in ScriptRunner does. It allows you to write an endpoint that does what you need it to. You could easily code an endpoint that responds only with the Status ID and nothing else when it is poked with an issue ID.
You don't do any work on your side and a handful of lines of code is going to be far more quick than Jira processing all the fields you ask for and sending back status object you don't want.
It looks like you're new here. Sign in or register to get started.