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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.