"errorMessages": [ "Can not deserialize instance of java.lang.String out of START_OBJECT token\n at

Romano Brooks November 17, 2020

Hi,

I am following this link . https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post. 

I did change the url in on myside however. When using this code it fails with .

"{
"errorMessages": [
"Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@810c29f; line: 1, column: 59]"
]
}"

url = "https://myatlassiansite.net/rest/servicedeskapi/request/GSD-139/comment"

auth = HTTPBasicAuth("me@me.com", "1234567894545604fefe64e")

headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}

payload = json.dumps( {
"visibility": {
"type": "role",
"value": "Administrators"
},
"body": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
"type": "text"
}
]
}
]
}
} )

response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=auth
)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

 

 

Please assist.

1 answer

1 accepted

1 vote
Answer accepted
Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 18, 2020

I'm not python expert, but could you change last line of code from

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

to

print(response.text) 

so we will know what is returned as response text

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events