Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Using the JIRA API to execute query with a contains filter on a custom string field.

Edited

I can easily construct a query on the web interface, but I'm struggling trying to get those same results from the JIRA API.

Specifically, I can issue a query as such:
jql=project=[projectname]%20AND%20summary~"Premium"

I believe that this works because 'summary' happens to be a built-in (non-custom) field.  I tried running the following query:
jql=project=[projectname]%20AND%20"My%20Field"%20~%20MyValue

And I get an exception: "The remote server returned an error: (400) ."

How do I get a filter with a contains operator on a custom string field to work from the API?

Thanks.

1 answer

0 votes

As I was doing further investigation on this issue, I was able to root cause the problem. It occurred to me that I should get the server response for more context information. So I updated my test app to do precisely that. I got the following server response:

"{"errorMessages":["Error in the JQL Query: 'Group' is a reserved JQL word. You must surround it in quotation marks to use it in a query. (line 1, character 30)"],"errors":{}}"

My test application is a C# console application and I was passing in the query as the command line parameter. The command line processor escaped the quotes and effectively removed them. Changing those instances of "'s to \"'s fixed the problem.

Duh, that was embarrassing, though if it happened to me, it may happen to someone else so I'm updating this issue.

When all else fails, get the server response.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you