JQL queries failing in python search (anonymous user?)

Stephen Denman June 7, 2019

Hi Everybody

I'm trying to do some manipulation of tickets in JIRA cloud using the python API - something I have done before but we have sinced switched to gsuite and google logins.

from jira import JIRA

I am logging in using an email/APIKey combo 

Jira_username = args.username //set as email address in the args
Jira_password = args.password // set as token key in args

jira_options ={
'server': 'https://[Company].atlassian.net',
'verify': cafile,
}
append_log(log_file, "Connecting to JIRA", args.logging, verbose, message_level=1)
try:
jira = JIRA(jira_options, basic_auth=(Jira_username, Jira_password), )
except Exception as ex:
append_log(log_file, "JIRA connection Failed with Exception: %s" % ex.message, args.logging, verbose, message_level=1)

This all appears to works fine

When I try to do a search however, using JQL that works in the web browser:


JQL_Filter = "remainingEstimate is not EMPTY AND statusCategory != Done AND Team not in (15, 43, 16)"
append_log(log_file, "Searching for issues with filter: ' %s ' " % JQL_Filter, args.logging, verbose, message_level=2)

List_Of_Jiras = jira.search_issues(JQL_Filter)

 

At this point I get 

jira.exceptions.JIRAError: JiraError HTTP 400 url: https://[COMPANY].atlassian.net/rest/api/2/search?jql=remainingEstimate+is+not+EMPTY+AND+statusCategory+%21%3D+Done+AND+Team+not+in+%2815%2C+43%2C+16%29&validateQuery=True&startAt=0&maxResults=50
text: Field 'remainingEstimate' does not exist or this field cannot be viewed by anonymous users.

I get the same if I just restrict the JQL to "team = 14" or similar

 

Any ideas? 

(ps, have put [Company] in manually for obvious reasons)

2 answers

1 accepted

0 votes
Answer accepted
Stephen Denman June 25, 2019

Turns out our domain extension had changed on the login - but the feedback from the API is less than optimal.

0 votes
Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2019

Hi @Stephen Denman 

I don't know Python because I use C# for my APIs, but are you able to do a very simple query?

e.g. just use 

/rest/api/2/search

without any extra parameters. What does that do?

If that works, then it would point to your JQL, so try building the JQL up slowly - use 

jql=remainingEstimate is not EMPTY

initially. 

BTW the error message may not be totally accurate - if any part of the JQL is at fault, you may get the same message

Stephen Denman June 7, 2019

For clarity, I will edit my post - when I tried "team = 14" I get the same error but with "field Team does not exist " etc - so I dont' think it is the JQL specifically? 

Suggest an answer

Log in or Sign up to answer