In a jql query, how do you do an AND on two different labels?
In the Advance Search in the UI, I can use this expression and get 10 results:
labels = v6 AND labels = TestLabel
But when I use this jql query and curl, I get zero results; no errors, no issues:
--data '{"jql":"labels = v6 AND labels = TestLabel"}'
...
{"startAt":0,"maxResults":50,"total":0,"issues":[]}
In the jql query, I can do either label and get 50 of results (maxResults).
How do you do the AND in jql?
Actually, I am beginning to suspect it is a permissions issue, and am trying to confirm. The account I use for API access is supposed to be identical to my login, but it is different. And though the API call is seeing the maxRecord 50 results for each label, I am not finding any that actually have both labels. (Stupid permissions issues will get you every time.) I'll post an update when I know for sure.
User error. The API account did not have access to the projects that had both labels. it did have access to projects that one or the other label, which is what caused my confusion. Thanks all who made suggestions!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm glad you got to the bottom of it!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mike,
what you're seeing says to me that the problem is not with the jql search you're using but with the way it is being sent using cURL.
Can you confirm that you are sending a POST?
Are you adding a Content-Type header?
Hopefully we can get you unblocked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'd recommend looking at some of these examples
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This one also returns no results
{"jql":"labels in (v6) and labels in (TestLabel)"}
Again, I can do either label individually and get maxResult results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mike,
Try the cURL command with the JQL append to the URL, e.g:
curl -D- -X GET -H "Authorization: Basic encoded" -H "Content-Type: application/json"
https://<base_url>/rest/api/2/search?jql=labels = v6 and labels = TestLabel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could try this with the url encoded
eg.
https://<base_url>/rest/api/2/search?jql=labels%20%3D%20v6%20and%20labels%20%3D%20TestLabel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.