Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

JQL queries failing in python search (anonymous user?) Edited

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

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

0 votes
Warren Community Leader Jun 07, 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

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
TAGS
Community showcase
Published in Jira Software

How to create Jira issus from Excel file?

When to use CSV importer When managing your processes in Jira, there are many occasions where you need to create a lot of tasks. Creating them one by one will cost you a lot of time and effort and i...

4,664 views 22 33
Read article

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