Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Jira REST API to get projects?

Hi all,

I need help whats the API call in jira to get projects in jira

Thanks,

Rajesh.

3 answers

1 accepted

6 votes
Answer accepted
Andy Heinzer Atlassian Team Apr 05, 2019

Hi,

Since the original answer was posted to this question Atlassian Cloud has deprecated that specific endpoint (GET /rest/api/2/project).   As such there is another endpoint you can use now to get back your projects via REST in Jira Cloud.

For Jira Cloud:

Since you can no longer use the old endpoint, you can instead use the GET /rest/api/3/project/search to return these projects via a search

 

For Jira Server:

You can make a REST API call to the endpoint GET /rest/api/2/project.  In Jira Server this endpoint will return to you all the projects which are visible to the user making that REST call.

I hope this helps to clarify how you can do this in both platforms.

Andy

From what I can find online, the cloud /rest/api/3/project/search does not have an option for returning ALL projects. Do you know if this possible?

Figured it out;

/rest/api/3/project/search?jql=&maxResults=200

Like # people like this
1 vote

Hi Rajesh,

You would use the following endpoint:

/rest/api/2/project

Take a look at the REST API documentation for Get All Projects:

 

Get all projects

GET /rest/api/2/project

Returns all projects visible for the currently logged in user, ie. all the projects the user has either ‘Browse projects’ or ‘Administer projects’ permission. If no user is logged in, it returns all projects that are visible for anonymous users.

App scope required: READ

Response content type: application/json

Request

Query parameters

expand

string

Multi-value parameter defining request properties to expand in the response. These are not returned by default. Allowed values:

  • description - description of the project.
  • projectKeys - all project keys associated with the project.
  • lead - project lead. Note, that project lead role is different from project administrator one.
  • issueTypes - issue types associated with the project.
  • url - a URL associated with the project.

recent

integer

Only projects recently accessed by the current user will be returned if this parameter is set. If no user is logged in, recently accessed projects will be returned based on current HTTP session. Maximum count is limited to the specified number, but no more than 20.

Take a look at that and let me know if it helps.

Cheers,

Branden

Is it possible to get some projects as the project name starts with "ABC" or "ABC*"?

Andy Heinzer Atlassian Team Jul 21, 2020

The answer if different between Cloud and Server.  

For Server, there is no REST API endpoint you can query to search by projects like this.

But in Cloud you could use the endpoint of GET /rest/api/3/project/search : Get projects paginated to at least search for projects by name.  Granted this does not let you specify begins with, but instead will search the entire title for any string that you might include in the query parameter of that endpoint.  For example doing a search there of ABC would include any project names that contain that string, not just those that start with that string.

Like Domingos Vargas likes this

@Andy Heinzer - Is there any plans to add the search feature to the Server version?  Some of our customers have many projects and are experiencing slow load times with our product because we are fetching all projects.  A search API would be very beneficial.

Also, is there may be another strategy we could leverage?  Our goal is just to return a list of Project Names and IDs . . . we don't need all the details.

Andy Heinzer Atlassian Team Jul 13, 2021

Hi @Chris Caspanello 

I have not found an easy way to manage this in Jira Server/Data Center.  The existing server REST API endpoints don't permit you to query or filter down the returned projects in the manner of search at this time. So I created a feature request for this over in https://jira.atlassian.com/browse/JRASERVER-72607

I can certainly understand why this would be useful to have, and seeing that Jira Cloud already does this, it makes sense that this is something that could improve performance in some cases and ease integrations.  Currently, the only way to return a single specific project would be to know either the project key or project id and then call the endpoint GET /rest/api/2/project/{projectIdOrKey} where you can pass that info in the call itself.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you