Programmatically test if an issue is archived

Hi,
As reported here, Jira has introduced a way to archive an issue and put it in read only.

What is the best way to test this programmatically in order to change the UI of an app accordingly?

Hello Sax,

to check whether issue is archived, you can use following method of the Issue object:

issue.isArchived()

Kind regards,
Markéta

Hi Markéta,
Thanks for the hint!
Is there a way to get the same info from from the REST API?

Hello Sax,

sorry for late answer. If you haven’t resolved this issue yet (or it might help someone else :slight_smile: ), you can obtain this information using standard Jira Issue API. For example, you can use following endpoint:

{baseUrl}/jira/rest/api/2/issue/{issueId}

which returns you complete issue information. In the case the issue is archived, you will find following attribute:

"archiveddate":"2020-02-11T14:22:29.803+0100"

in the case the issue is not archived (despite it might been in the past), you will see “null”:

"archiveddate":null

Hope it helped.
Kind regards,
Markéta

Brilliant, thanks a lot!