a=(issues["fields"]["assignee"]["name"])
#print (a)
tricat = (issues["fields"]["customfield_14307"])
#print(tricat)
url = "http://ontrack-internal.mycpmpany.com/rest/api/latest/issue"
payload = "{\r\n\t\"fields\":{\r\n\"project\":{\"key\":\"SSET\"},\r\n\"summary\":" + s + ",\r\n\"description\":" + (k + s) + ",\r\n\"issuetype\":{\"name\":\"Task\"},\r\n\"customfield_12610\":{\"value\":\"High\"},\r\n\"components\":[{\"name\":\"Other\"}],\r\n\"assignee\":{\"name\":"+ a +"}\r\n}}"
headers = {
'authorization': "Basic dGFjY3VzZXI6QUg2NF91aDE=",
'content-type': "application/json",
'cache-control': "no-cache",
'postman-token': "07236ec6-85de-3202-49ce-cfc4e78a0eac"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
Getting error
{"errorMessages":["Unexpected character ('H' (code 72)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@4b650670; line: 4, column: 13]"]}
{
{"errorMessages":["Unexpected character ('U' (code 85)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@4b650670; line: 4, column: 13]"]}
Please help me to resolve it
Hi Rahul,
My first thought is the method the request is being called with. If you use :
response = requests.post(url, data=payload, headers=headers)
Does it still return an error? Additionally you may need to dump the payload to json first before the request is sent.
import json
...
json_data = json.dumps(payload)
response = requests.post(url, data=json_data, headers=headers)
Hope that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.