You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding a formatted comment isn't working using this package. When the same POST request is made using the requests library directly, the functionality works as expected.
Is there an existing issue for this?
I have searched the existing issues
Jira Instance type
Jira Cloud (Hosted by Atlassian)
Jira instance version
No response
jira-python version
"3.1.1", "3.4.1"
Python Interpreter version
3.9
Which operating systems have you used?
Linux
macOS
Windows
Reproduction steps
# 1. Given a Jira client instancejira=JIRA(basic_auth=('email', 'API token'))
comment=json.dumps( {
"body": {
"type": "doc",
"version": 1,
"content": [
{
"type": "codeBlock",
"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"
}
]
}
]
}
} )
# 2. When I call the function with argument xjira.add_comment("AB-123", comment)
Hey @armaandhull
This is not a bug, you're sending the wrong body content hence the 400 error. That's why the error mentions that the comment body isn't valid.
Regarding the 400 error, the class for Comment already sends the "body" key in the payload as it's constructed for it, so there's no need to add it again.
What you need to do is
# 1. Given a Jira client instancejira=JIRA(basic_auth=('email', 'API token'))
# remove the body key as call the valuecomment= {
"type": "doc",
"version": 1,
"content": [
{
"type": "codeBlock",
"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"
}
]
}
]
}
jira.add_comment("AB-123", comment)
Edited: I looked at the error again and noticed you're already on v3.
Bug summary
Adding a formatted comment isn't working using this package. When the same
POST
request is made using therequests
library directly, the functionality works as expected.Is there an existing issue for this?
Jira Instance type
Jira Cloud (Hosted by Atlassian)
Jira instance version
No response
jira-python version
"3.1.1", "3.4.1"
Python Interpreter version
3.9
Which operating systems have you used?
Reproduction steps
Stack trace
Expected behaviour
Formatted comment is added to the JIRA issue
Additional Context
No response
The text was updated successfully, but these errors were encountered: