Update a comment with rich text HTML via REST API | Community
Skip to main content
September 24, 2025
Solved

Update a comment with rich text HTML via REST API

  • September 24, 2025
  • 3 replies
  • 782 views

I can successfully create a comment (as seen in Workfront UI Updates section) of an Issue with this REST API call using v20

```

curl --location 'https://SUBDOMAIN.workfront.com/attask/api/v20.0/note' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"objID": "68d2c7fe00911872fc05f2e559650090",
"objCode": "NOTE",
"html": "Hello <b>World</b> from Postman JSON 1",
"noteText": "Hello Plain from Postman JSON 1",
"noteObjCode": "OPTASK",
"json": "{}"
}'

```

 

The problem is updating a comment (with or without a nested comment). I can only update the plain text noteText, the HTML is not overwritten. Since Adobe Workfront UI only displays the HTML comment this update is not displaying!!

 

```

curl --location --request PUT 'https://SUBDOMAIN.workfront.com/attask/api/v20.0/note/68d43bd6004d01abe8f85c5726e94108' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"objID": "68d2c7fe00911872fc05f2e559650090",
"objCode": "NOTE",
"html": "Hello <b>World</b> from Postman JSON 2",
"noteText": "Hello Plain from Postman JSON 2",
"noteObjCode": "OPTASK",
"json": "{}"
}'

```

 

I also tried sending the rich text format in Draft.js JSON

```

curl --location --request PUT 'https://SUBDOMAIN.workfront.com/attask/api/v20.0/note/68d43bd6004d01abe8f85c5726e94108' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"objID": "68d2c7fe00911872fc05f2e559650090",
"objCode": "NOTE",

"noteObjCode": "OPTASK",
"noteText": "Update 3",
"json": "{\"blocks\":[{\"key\":\"some_random_key\",\"text\":\"Update 3\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[],\"data\":{}}],\"entityMap\":{}}"
}'

```

Best answer by DanielBr21

I got this to work by reverse engineering the Workfront UI using their GraphQL endpoint

curl --location 'https://SUBDOMAIN.workfront.com/comments/api/graphql' \ --header 'Content-Type: application/json' \ --header 'Authorization: ••••••' \ --data '{"variables":{"data":{"commentID":"68d5855900024794261c45be7626bf51","contentHTML":"<p class=\"react-spectrum-RichTextEditor-paragraph\" dir=\"ltr\" style=\"margin: 0px; padding: 0px;\"><span style=\"white-space: pre-wrap;\">Hello 11:13</span></p>","content":"Hello 11:13","tags":[],"attachments":[]}},"query":"mutation ($data: InputEditData) {\n editComment(data: $data) {\n attachments {\n id\n name\n type\n __typename\n }\n contentHTML\n content\n tags {\n id\n objCode\n __typename\n }\n metadata\n modified\n modifiedBy\n lastModifiedAt\n __typename\n }\n}"}'

3 replies

September 24, 2025
September 24, 2025
Srinija_N
Level 7
September 25, 2025

We used Draft.js to HTML and fixed the text patterns which has paragraph breaks accordingly.

 

 

 

DanielBr21AuthorAccepted solution
September 25, 2025

I got this to work by reverse engineering the Workfront UI using their GraphQL endpoint

curl --location 'https://SUBDOMAIN.workfront.com/comments/api/graphql' \ --header 'Content-Type: application/json' \ --header 'Authorization: ••••••' \ --data '{"variables":{"data":{"commentID":"68d5855900024794261c45be7626bf51","contentHTML":"<p class=\"react-spectrum-RichTextEditor-paragraph\" dir=\"ltr\" style=\"margin: 0px; padding: 0px;\"><span style=\"white-space: pre-wrap;\">Hello 11:13</span></p>","content":"Hello 11:13","tags":[],"attachments":[]}},"query":"mutation ($data: InputEditData) {\n editComment(data: $data) {\n attachments {\n id\n name\n type\n __typename\n }\n contentHTML\n content\n tags {\n id\n objCode\n __typename\n }\n metadata\n modified\n modifiedBy\n lastModifiedAt\n __typename\n }\n}"}'