Forums

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

Get all project listing along with their status (active/inactive/archieve)

Rashi Goyal October 14, 2020

Hi Team,

I want to fetch the list of all the projects for a particular domain(say https://xyz.com) i.e. all project names, their keys, status(if that project is marked as active/inactive/archive by that particular domain). Basically, through status, I want to track all projects.

Please suggest the API Url to get all the details asap.

@Warren do you have any idea for the same also? Anyone else having knowledge about this please respond.

Thanks

Rashi

3 answers

1 vote
Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2020

Project archiving is available for Jira Software Data Center and Jira Service Desk Data Center. For Jira Server and Jira Cloud, the endpoint:

/rest/api/{version}/project/{projectIdOrKey}

returns a value 'active' which will be either true or false. There doesn't seem to be any value returned that indicates if it's been archived.

However, the REST API v3 endpoint:

/rest/api/3/project/search

has an experimental feature that allows you to set the filter parameter of 'status' as being an array of three possible values, 'live', 'archived' or 'deleted' to filter the results. So the query:

/rest/api/3/project/search?status=archived

would return a list of projects that had the status of being archived.

Refer to this article for more information on how to use that endpoint.

Rashi Goyal October 15, 2020

@Sunny Ape when I am using URL /rest/api/3/project/search?status=archived

I am getting a blank array as 

stdClass Object
(
    [self] => https://netsmartz.atlassian.net/rest/api/3/project/search?maxResults=50&startAt=0&status=archived
    [maxResults] => 50
    [startAt] => 0
    [total] => 0
    [isLast] => 1
    [values] => Array
        (
        )

)

Can you please guide why this array is blank.

And also when I am using URL /rest/api/{version}/project/{projectIdOrKey}

then, which field/array will indicate that the project is archived or not.

Thanks for the help BTW

 

Rashi

1 vote
Carlos Garcia Navarro
Community Champion
October 14, 2020

Hi @Rashi Goyal ,

As you are in cloud, it seems that there is a feature request to cover your request:

https://jira.atlassian.com/browse/JRACLOUD-30664

(As a side note, for Server there is this ticket:

https://jira.atlassian.com/browse/JRASERVER-30664 )

That said, in Cloud you can go to Jira Settings-> Projects and check  the last time that an issue was updated for every project. This could give you an idea of what projects may be inactive (if the haven't been updated in a number of months, e.g.):

Screen Shot 2020-10-14 at 11.23.16 PM.png

Regarding archived projects, this article contains details about how to manage archived projects in the Cloud: https://confluence.atlassian.com/adminjiracloud/archive-a-project-1013843066.html

From the article above, "Issues in archived projects won't appear in basic or advanced search results. You can access these issues through direct links, but you can't edit them"

Rashi Goyal October 14, 2020

@Carlos Garcia Navarro I want to do this programmatically using an API call.

Thanks still. If you have any idea related to the API please suggest

Thanks,

Rashi 

Carlos Garcia Navarro
Community Champion
October 14, 2020

Hi @Rashi Goyal ,

This document is a guide to the APIs to get project information:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-search-get

I ran the call /rest/api/3/project/search, but didn't get the information about 'last issue update' or information about active/inactive/archived.

I'll keep trying but I'm not sure you can get this from an API directly.

Rashi Goyal October 14, 2020

@Carlos Garcia Navarro I am also checking the same but this is giving me the list of all projects near about 800 but in actual active/live is 130.

@Warren any suggestion from your side. I want to develop something on urgent, please guide.

 

Rashi

0 votes
Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 16, 2020

Hi @Rashi Goyal 

Your return array being blank when you search for archive projects suggests that there aren't any. We don't archive projects and I get the same result, but if I use status=live then all our projects are returned.

So, what do you get for 

https://netsmartz.atlassian.net/rest/api/3/project/search?maxResults=50&startAt=0&status=live

That should only return the ~130 projects that you have.

Rashi Goyal October 16, 2020

@Warren I tried the same way but I am getting a total as 845 i.e. all projects archived/active/inactive

[maxResults] => 50
    [startAt] => 0
    [total] => 845

Does that mean there is no way to get the active projects right?

Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 16, 2020

Hi @Rashi Goyal 

If I run that API call on our system using the 3 options, this is what I get

ARCHIVED

Screenshot_4.jpgDELETED

Screenshot_5.jpgLIVEScreenshot_6.jpg

 

This exactly matches what is on our system, and you should be getting the same on yours. Are you certain that the API call is going through correctly? 

Could you copy the API call into a browser and run it from there, like I have done? That eliminates any changes that your code may be doing. So literally copy

https://netsmartz.atlassian.net/rest/api/3/project/search?maxResults=50&startAt=0&status=live

into a browser where you're already logged in to Jira, and give us a screenshot similar to what I showed above

Rashi Goyal October 16, 2020

@Warren please check the response. I did it in the same way. 

{"self":"https://netsmartz.atlassian.net/rest/api/3/project/search?maxResults=50&startAt=0&status=live","nextPage":"https://netsmartz.atlassian.net/rest/api/3/project/search?maxResults=50&startAt=50&status=live","maxResults":50,"startAt":0,"total":845,"isLast":false,"values":[{"expand":"description,lead,issueTypes,url,projectKeys,permissions,insight","self":"https://netsmartz.atlassian.net/rest/api/3/project/13700","id":"13700","key":"AA","name":"ABC Automation","avatarUrls":{"48x48":"https://netsmartz.atlassian.net/secure/projectavatar?pid=13700&avatarId=10011","24x24":"https://netsmartz.atlassian.net/secure/projectavatar?size=small&s=small&pid=13700&avatarId=10011","16x16":"https://netsmartz.atlassian.net/secure/projectavatar?size=xsmall&s=xsmall&pid=13700&avatarId=10011","32x32":"https://netsmartz.atlassian.net/secure/projectavatar?size=medium&s=medium&pid=13700&avatarId=10011"},"projectTypeKey":"software","simplified":false,"style":"classic","isPrivate":false,"properties":{}},

 Still total is 845. It must be 137

Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 16, 2020

Hi @Rashi Goyal 

So if only 137 projects are live, what state are the rest? Are they all archived? What happens if you run the API call with status=archived? Let's see those results

Rashi Goyal October 16, 2020

@Warren using the url:  https://netsmartz.atlassian.net/rest/api/3/project/search?maxResults=50&startAt=0&status=archived

 

Result is :: 

{"self":"https://netsmartz.atlassian.net/rest/api/3/project/search?maxResults=50&startAt=0&status=archived","maxResults":50,"startAt":0,"total":0,"isLast":true,"values":[]}

projects are archived I checked. 

I don't understand what is the actual problem.

Rashi

Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 16, 2020

The URL in that example shown starts with 'netsmartz.atlassian.net'. That is a Jira Cloud instance.

This article says that archiving projects is only available for Jira Software Data Center and Jira Service Desk Data Center.

But this article says project archiving is available for Jira Software Cloud but only the Premium plans.

I've sent a content notice to Atlassian that the two pages seem to contradict each other.

If you are certain that Netsmartz is using a version / plan of Jira that supports project archiving, and you are certain there are projects that have been archived, as per the documentation, but the REST API is returning an empty array (no archived projects) when queried correctly, and you're authenticating with an account that has the appropriate permissions to browse archived projects, then something is wrong and I think you should contact Atlassian support for assistance.

Like Earl McCutcheon likes this
Rashi Goyal October 18, 2020

Thanks, @Sunny Ape 

Let me confirm. 

Did you get the answer to your query from Jira support? Please confirm.

@Warren any guidance from your side?

Rashi

Suggest an answer

Log in or Sign up to answer