Forums

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

Restrict custom field extraction when using curl

Gerardo Dalena
Contributor
February 13, 2023

Hello,

total noob here :).

I'm trying to use API to get result from a filter, but from all issues I want to only export certain custom fields. If I use this link in the same browser I use for jira:

https://mydomain.atlassian.net/rest/api/2/search?filter=10861&fields=id,key,status,description,customfield_10571,customfield_10063

I get what I want. However, when I use a linux machine to perform a curl with this command:

curl -u my@username:token -o /home/whatever/test.json --request GET https://mydomain.atlassian.net/rest/api/2/search?jql=filter=10861&fields=id,key,status,description,customfield_10571,customfield_10063

The file I get has all the custom field exported. The link that curl and I are pointing is the same, but the result is different. What am I missing?

Thank you!

1 answer

1 accepted

0 votes
Answer accepted
Gerardo Dalena
Contributor
March 9, 2023

Hello,

turns out that the problem was some missing apex. Some characters, such as "&", are not read correctly. What happened was that the curl cut everything that came after the & and it went with the default setting, which is to export everything from an issue. This can be fixed by putting the url between apex:

 

curl -u my@username:token -o /home/whatever/test.json --request GET 'https://mydomain.atlassian.net/rest/api/2/search?jql=filter=10861&fields=id,key,status,description,customfield_10571,customfield_10063'

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events