Forums

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

Why a REST call to make or remove a filter from favourites does not work?

Giuseppe_Passino February 12, 2020

Hello! I am trying to add a filter to favourites using the REST API, and I make this call:

### Request
curl -u gpassino -v -d '{"favourite":true}' -H 'Content-Type: application/json' -X PUT https://jira.prod.bloomberg.com/rest/api/2/filter/25109

### Response
{"self":"https://jira.prod.bloomberg.com/rest/api/2/filter/25109","id":"25109","name":"temp peppe","description":"hello","owner":{"self":"https://jira.prod.bloomberg.com/rest/api/2/user?username=gpassino","key":"gpassino","name":"gpassino","avatarUrls":{"48x48":"https://www.gravatar.com/avatar/19bd32320d9eaa7e2bed642709c4a73f?d=mm&s=48","24x24":"https://www.gravatar.com/avatar/19bd32320d9eaa7e2bed642709c4a73f?d=mm&s=24","16x16":"https://www.gravatar.com/avatar/19bd32320d9eaa7e2bed642709c4a73f?d=mm&s=16","32x32":"https://www.gravatar.com/avatar/19bd32320d9eaa7e2bed642709c4a73f?d=mm&s=32"},"displayName":"Giuseppe Passino","active":true},"jql":"labels = TeamMoca AND summary !~ coordination AND status != Done AND (resolution != withdrawn AND resolution != \"Won't Do\" OR resolution is EMPTY) ORDER BY Rank ASC","viewUrl":"https://jira.prod.bloomberg.com/issues/?filter=25109","searchUrl":"https://jira.prod.bloomberg.com/rest/api/2/search?jql=labels+%3D+TeamMoca+AND+summary+!~+coordination+AND+status+!%3D+Done+AND+(resolution+!%3D+withdrawn+AND+resolution+!%3D+%22Won't+Do%22+OR+resolution+is+EMPTY)+ORDER+BY+Rank+ASC","favourite":false,"sharePermissions":[{"id":85905,"type":"loggedin","view":true,"edit":false}],"editable":true,"sharedUsers":{"size":0,"items":[],"max-results":1000,"start-index":0,"end-index":0},"subscriptions":{"size":0,"items":[],"max-results":1000,"start-index":0,"end-index":0}}

 (the above is our internal jira installation). The response is 200, but the filter (both the returned one, and if I check in the browser) is still not favourite. Changing other properties such as the name works fine, the problem is just with the "favourite" attribute.

We are using Jira Server 7.13.2.

What could the problem be?

2 answers

0 votes
Philip Armour
Contributor
June 3, 2020

I found an alternative way to set and remove favourite filters via REST on JIRA Server (it works on JIRA 8.8.1 at least):

To set filter with ID 25109 as a favourite of the user whose credentials you give:

  • curl -D- -u '<user>:<password>' -X PUT -H "Content-Type: application/json" "https://your-site-name/rest/api/1.0/filters/25109/favourite"

To unset filter with ID 25109 as a favourite of the user whose credentials you give:

  • curl -D- -u '<user>:<password>' -X DELETE -H "Content-Type: application/json" "https://your-site-name/rest/api/1.0/filters/25109/favourite"
0 votes
Thomas Deiler
Community Champion
February 13, 2020

Dear @Giuseppe_Passino ,

can you please post you JSON data?

So long

Thomas

Giuseppe_Passino February 17, 2020

The JSON of the request is in the question. I also added the JSON of the response, highlighting how "favourite" is still false even after I set it to true.

Philip Armour
Contributor
June 2, 2020

Hi @Giuseppe_Passino ,

not sure if you are still stuck with this. I have had the same problem and found it very frustrating.

I did find an alternative way to set and remove favourite filters via REST:

To set filter with ID 25109 as a favourite of the user whose credentials you give:

  • curl -D- -u '<user>:<password>' -X PUT -H "Content-Type: application/json" "https://your-site-name/rest/api/1.0/filters/25109/favourite"

To unset filter with ID 25109 as a favourite of the user whose credentials you give:

  • curl -D- -u '<user>:<password>' -X DELETE -H "Content-Type: application/json" "https://your-site-name/rest/api/1.0/filters/25109/favourite"

Hope that is helpful,

Philip

Suggest an answer

Log in or Sign up to answer