I am trying to query the API using REST by a custom field in PHP but I seem to be getting the same results even if I use a different value, why is that?
https://morenafiore.atlassian.net/rest/api/latest/search?jql=project=OEWR&customfield_10020=danandmorena\u0040gmail\u002ecom&fields=created,issuetype,status,summary
https://morenafiore.atlassian.net/rest/api/latest/search?jql=project=OEWR&customfield_10020=hello\u0040morenafiore\u002ecom&fields=created,issuetype,status,summary
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 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
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.
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
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.
Hi Morena, Jim,
Apology for the delay here. The error that you are getting when running the query:
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 typesYou 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 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
do you still have the problem? if so can you paste your code and add a link if you can?
Thanks for your answer James. It worked for me. this is what I used:<my url>/rest/api/2/search?jql=cf[10020]~xxxxxxxfor curl :curl -D- -u USERNAME:PWD -X GET -H "Content-Type: application/json" -g <my url>/rest/api/2/search?jql=cf[10020]~xxxxxxxThanks
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
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.
It looks like you're new here. Sign in or register to get started.