8 answers

1 accepted

Comments Closed

Hi Jim

I was having the same issues and this is how I worked it out just now.

Instead of having customfield_10020=xxxx, change it to cf[10020]=xxxx

Hope this works for you

Thanks for your answer James. It worked for me.

this is what I used:

<my url>/rest/api/2/search?jql=cf[10020]~xxxxxxx

for curl :
curl -D- -u USERNAME:PWD -X GET -H "Content-Type: application/json" -g <my url>/rest/api/2/search?jql=cf[10020]~xxxxxxx

Thanks :)

Hi Morena,

From the provided URL, I understand that you would like to retrieve search result by using REST API, can you kindly confirm this? Anyway, you mentioned that you are getting the same results when using different values, may I know what results are you getting?

Anyway I did a quick test on my end, and I am able to retrieve a search result by running the following cURL command in the Terminal:
- curl -D- -u admin:admin -X GET -H "Content-Type: application/json" http://localhost:8080/jira/rest/api/latest/search?jql=project=PG+AND+test~"test"
-- test is a custom field in JIRA

Therefore, can you kindly try to apply the GET request as per suggested above, and see if it helps? You may need to change the project key and the custom field name/values as well.

Cheers.

Hi Morena,

Perhaps the following documentation on performing searches using REST may help:
- https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Query+issues

Thanks

Unfortunately that does not answer my question.

I am using the REST API with PHP. So I need to retrieve all the issues which are part of a project(OEWR) and where the custom field called customfield_10020 is equal to an email address.

So if I try this query

https://morenafiore.atlassian.net/rest/api/latest/search?jql=customfield_10020=danandmorena\u0040gmail\u002ecom&fields=created,issuetype,status,summary
I get the error "Field 'customfield_10020' does not exist or you do not have permission to view it.'. Please note the field's context is global and for all issue types.
 
If I add the project type to the query then the call return ALL ISSUES, which is wrong, no issues have "danandmorena@gmail.com" as value for field customfield_10020
https://morenafiore.atlassian.net/rest/api/latest/search?jql=project=OEWR&customfield_10020=danandmorena\u0040gmail\u002ecom&fields=created,issuetype,status,summary
 
I also tried with CURL, this request should not retrieve 13 results, but 0
curl -D- -u morena:mypassword -X GET -H "Content-Type: application/json" https://morenafiore.atlassian.net/rest/api/latest/search?jql=project=OEWR&customfield_10020=danandmorena@gmail.com&fields=created,issuetype,status,summary
 
So what's going wrong here? Is it a bug within the API?

Did you find a resolution to this? I'm having the same problem.

do you still have the problem? if so can you paste your code and add a link if you can?

Hi Morena, Jim,

Apology for the delay here. The error that you are getting when running the query:

I get the error "Field 'customfield_10020' does not exist or you do not have permission to view it.'. Please note the field's context is global and for all issue types.

This indicates that either the custom field with the ID 10020 does not exists, or the field itself is not applicable to the project OEWR. Since this is the case, things that I would like to check is:
- Confirm if the field with the ID 10020 exists: We can check this from the database level, using the following query:

select * from customfield where id=10020

You may also confirm the field name and field type from the results returned.

- Check the custom field configuration and confirm if the field is configured to be applicable to global context and all issue types
You can go to Administration > Custom Fields > Go to the field, and click on Configure > Edit Configuration. Check the custom field applicable issue types and applicable context and ensure that both are configured to 'Any issue type' and Global Context respectively

I hope that this will help, let us know how it goes.

Thanks.

Hi Ahmad

 

can you please say me where i can configure the custom-field setting could you brief me as i am new to work on this tool

Please see the accepted answer, but bear in mind it is 5 years old.

Hi Ahmad thank you so much for the answer.

I think I have solved the problem

Morena

Could you include your resolution, as I'm having the same problem.

My CURL query results in all fields of all issues being returned.

Thanks,

Jim

Hi Jim

I was having the same issues and this is how I worked it out just now.

Instead of having customfield_10020=xxxx, change it to cf[10020]=xxxx

Hope this works for you

Hi 

 

i am facing the same issue i had tried using "cf[14729]=AA: Analytics"

but not working, it is showing


"errorMessages": [
"Error in the JQL Query: Expecting either 'OR' or 'AND' but got 'Analytics'. (line 1, character 90)"
],
"errors": {}

could anyone please suggest some solution on how to use customfields in querying

Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,296 views 14 20
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot