I am trying to use bulk api edit endpoint to add comment. Here is my code:
https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/ . The error i get is
Error: 400 - {"errorMessages":["Invalid request payload. Refer to the REST API documentation and try again."]} which is very generic.
Here is a working version of fix version and priority if anyone needs it:
Any help is appreciated.
@umits2009 welcome to the community!
Could you please try below.
import requests
from requests.auth import HTTPBasicAuth
import json
# Replace with your Jira domain, API token, and username
url = f"{DOMAIN}/rest/api/3/bulk/issues/fields"
auth = HTTPBasicAuth(USERNAME, API_TOKEN)
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
# Correctly structured payload for the rich text comment
payload = json.dumps({
"editedFieldsInput": {
"richTextFields": [
{
"fieldId": "comment",
"richText": {
"version": 1,
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Hello "
},
{
"type": "text",
"text": "world",
"marks": [
{
"type": "strong"
}
]
}
]
}
]
}
}
]
},
"selectedIssueIdsOrKeys": [
"TLP-141103" # Replace with your issue key
],
"selectedActions": [
"comment"
],
"sendBulkNotification": True # This will send a notification
})
response = requests.post(
url,
data=payload,
headers=headers,
auth=auth,
verify=False
)
# Check for success or errors
if response.status_code == 201:
print("Issues updated successfully!")
else:
print(f"Error: {response.status_code} - {response.text}")
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.