jira API V3 get projects - how to specify properties to return

dmitry dobryak May 3, 2021

Hi!

There is a method "Get projects paginated"
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-search-get

 

with query parameter "properties", which should allow to specify properties to return:

properties

Array<StringList>

EXPERIMENTAL. A list of project properties to return for the project. This parameter accepts a comma-separated list.

 

I tried to use several approaches but each time I get the same results. Besides id and key I am also received name, avatarUrls, projectTypeKey and etc. Examples of my attempts:

1) curl --request GET \
--url 'https://dmitrdv.atlassian.net/rest/api/3/project/search?properties=id,key' \
--user 'email@example.com:<api_token>' \
--header 'Accept: application/json'

2) curl --request GET \
--url 'https://dmitrdv.atlassian.net/rest/api/3/project/search?properties[]=id,key' \
--user 'email@example.com:<api_token>' \
--header 'Accept: application/json'

 

How to properly use  "properties"? could you give example?

2 answers

1 accepted

1 vote
Answer accepted
David Bakkers
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.
May 3, 2021

Hello @dmitry dobryak

All the characteristics of the project, like the ID, key, name etc are not properties, they are the built-in values, that is why you aren't getting any additional results back in your search.

Have a look at the documentation for the Project Properties endpoint. There you will see how to use /rest/api/3/project/{projectIdOrKey}/properties to query what properties a project has.

Once you know what properties are available, they are what you can put in your project search request, like this:

https://dmitrdv.atlassian.net/rest/api/3/project/search?properties=searchRequests,jswSelectedBoardType

In the results returned, you'll see the expansion of the properties, like this:

"properties": {
  "searchRequests": {
    "ids": []
  },
  "jswSelectedBoardType": {
    "jswSelectedBoardType": "scrum"
  }
}

dmitry dobryak May 3, 2021

yes, thanks

David Bakkers
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.
May 3, 2021

No problem @dmitry dobryak 

If you think my answer was correct, please mark it as the correct answer so that next person who reads the thread will be able to refer to it.

0 votes
dmitry dobryak May 3, 2021

I realized that it is related to what should be returned inside "properties: {}" in response. And proper request will be :

 

curl --request GET \
--url 'https://dmitrdv.atlassian.net/rest/api/3/project/search?properties=name1,name2,name3' \
--user 'email@example.com:<api_token>' \
--header 'Accept: application/json'

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events