JIRA not recognizing object in cURL POST call


This is the error I am currently getting while using the jira-python python module to automate some logging to JIRA.

Traceback (most recent call last):
  File "/home/csd-user/test/libs/utils/butler.py", line 217, in <module>
  File "/home/csd-user/test/libs/utils/butler.py", line 214, in main
  File "/home/csd-user/test/libs/utils/butler.py", line 47, in log_bug_exec
  File "/home/csd-user/test/libs/utils/butler.py", line 108, in process_file
  File "/home/csd-user/test/libs/utils/butler.py", line 207, in submit_bug
    iss = cls.my_server.create_issue(fields=bug.json_dict['fields'])
  File "/opt/clearsky/lib/python2.7/site-packages/jira/client.py", line 706, in create_issue
    r = self._session.post(url, data=json.dumps(data))
  File "/opt/clearsky/lib/python2.7/site-packages/jira/resilientsession.py", line 81, in post
    return self.__verb('POST', url, **kwargs)
  File "/opt/clearsky/lib/python2.7/site-packages/jira/resilientsession.py", line 74, in __verb
    raise_on_error(r, verb=verb, **kwargs)
  File "/opt/clearsky/lib/python2.7/site-packages/jira/utils.py", line 120, in raise_on_error
    r.status_code, error, r.url, request=request, response=r, **kwargs)
# This is the important part...
jira.utils.JIRAError: JiraError HTTP 400
	text: data was not an object
	url: https://jira.clearsky-data.net/rest/api/2/issue

My problem is that, as far as I can see, the dict object that I am passing it is perfectly valid. 

BUG FIELDS :: {'environment': 'node => 62-qa-driver12 (M3 - HA Only)\nversion => \nurl => https://jenkins.clearsky-data.net/job/BugLoggerTest/144/\ntimestamp => 2015-06-29_11-11-15\njob name => BugLoggerTest\nbuild number => 144\nversion number => Not present. Check git hash. Maybe add in processing of full failure list!\n', 'description': '', 'summary': 'Fill in Something', 'project': {'key': 'QABL'}, 'assignee': 'qa-auto', 'issuetype': {'name': 'Bug'}, 'priority': {'name': 'Major'}}

CLASS :: <type 'dict'>

Is formatted by this...

# creating JSON object (bug should not have to be changed after initialization)
        self.json_dict = ( {"fields": {
            "project": {'key': self.project},
            "issuetype": {'name': self.issue_type},
            "priority": {'name': self.priority},
            "assignee": self.assignee,
            "environment": self.environment,
            "description": self.description,
            "summary": self.summary } } )

This is the call to create the issue where the error is being thrown...

iss = cls.my_server.create_issue(fields=bug.json_dict['fields'])

I'd love some help trying to figure this out. Been banging my head against a wall all day so far. Thanks!

1 answer

anyone have any idea?

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,898 views 12 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot