I have no idea what the error this command (the request line) throws means and there doesn't seem to be any information online about it.
data = {
....: 'fields':
....: {
....: 'environment': '- \\n- Repeated : 0 times',
....: 'description': '',
....: 'summary': 'Fill in Something',
....: 'project': {
....: "key": "QABL"
....: },
....: 'assignee': 'qa-auto',
....: 'issuetype': 'Bug',
....: 'priority': 'Major'
....: }
....: }
print header
{'content-type': 'application/json'}
r = requests.post("https://jira.some-company.net/rest/api/latest/issue/", headers=header, auth=requests.auth.HTTPDigestAuth('user', 'password'), data=data)
r.json()
I tried to do a post request to JIRA using the request library, and the JSON response to r.json() looks like this...
{u'errorMessages':
[u"Unrecognized token 'filspoetfed': was expecting 'null', 'true', 'false' or NaN\n
at [Source: org.apache.catalina.connector.CoyoteInputStream@10758d77; line: 1, column: 23]"]}
Anybody seen this before? There is no attribute 'filspoetfed' in my JIRA issue/JSON, so I don't understand. The only other possibility to my knowledge is that it is getting transferred into unicode when it gets submitted...but if that is the problem I don't know how to get around it. I did this in the same format as on the JIRA REST api page. Help would be greatly appreciated!
I had a similar issue and solved it by changing the request
requests.post(url, data = json.dumps(data),auth=HTTPBasicAuth(username, password), headers= header)
The important thing is to use json.dumps(data) instead of data and in the header also included
'Accept': 'application/json'
Hope it works for you! Have a nice day
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With