Can not create a ticket with comments > html_body. The description field is required???
I'm using the API to create a ticket, everything works fine, except I can not get HTML to work. The description value always overrides the comment, and the description.
And when description is not included I get this error:
{
'error':'RecordInvalid',
'description':'Record validation errors',
'details':
{'base':[{
'description':'Description: cannot be blank',
'error':'BlankValue',
'ticket_field_id':20690401,'ticket_field_type':'FieldDescription'}
]
}
}
I have comment included in the API call, but it does nothing (no error ,unless description is removed from the call)
"comment": {
"html_body ": "<b>test</b>"
},
Which is weird, since the docs (https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#description-and-first-comment) say to use comment vs description, but the validation seems to be making this impossible.
I checked in the admin, and Description is a standard field and I can not change the required property. What am I missing?
-
Hi Brook Davies,
HTML is stripped from comment body. Use `html_body` instead. Refer to documentation here for more.
-
Hi Ahmed,
There was an error in my original post... the problem is that without description included I get an error that that field is required.
-
Hi Brook Davies,
Description gets populated by the first comment body or html_body. Did you make sure to include the comment within the "ticket" envelope?
Here is my request that gets executed successfully:
curl https://{subdomain}.zendesk.com/api/v2/tickets.json \
-X POST \
-d '{ "ticket": { "subject": "Test Subject", "comment": { "html_body": "<b>test</b>" } } }' \
-H "Content-Type: application/json" \
-u {user}/token:{token} -
Your code worked... maybe I was using "body" and no "html_body".... hmmmm. Thanks Ahmed. You da man!!!!
-
Glad I could help. All the best!
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
5 Kommentare