REST API Endpoint for customfield_number is not empty

Miraculous Ladybug August 17, 2022

I'm working on a get request that gives me all JIRA issues with the custom field "Sponsor". Since it's an optional field, the value is often empty. So out of all issues in a JIRA project, how can I extract those who have a sponsor? My query looks like this so far

https://jira.companyname.com/rest/api/2/search?jql=project=projectname&maxResults=1000

What is missing? I do know the customField name and id.

I tried

jql=project=projectname&maxResults=1000&customfield_number!%3DEMPTY

and

jql=project=projectname&maxResults=1000&customfield_number!%3Dnull

But it didn't work

1 answer

1 accepted

1 vote
Answer accepted
Tessa Tuteleers
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 17, 2022

Hi @Miraculous Ladybug , 

Welcome to the community!! 

You can just add it to the JQL query param normally:

Project = yourProject AND yourNumberField is not EMPTY

 

Hope this helps! 

- Tessa

Miraculous Ladybug August 18, 2022

Thanks Tessa :) My problem is that I'm writing the query in my URL and not in code.  I don't quite understand how I can write this in my URL... Do you have an idea?

Tessa Tuteleers
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 18, 2022

Hi @Miraculous Ladybug , 

I haven't run this particular one, but normally you just have to encode the params to use the in URL. You can use sites to do this for you like urlencoder.org. 

Depending on how you are running the call there are other ways ofc. 

- Tessa

Suggest an answer

Log in or Sign up to answer