Trying to add comment via ZAFClient in app
AnsweredI'm trying to add internal comments to a ticket under certain user interactions with an app I'm building. I don't see any ZAF client native calls to do it (other than placing a comment in the comment editor), so I'm trying to do it as an api call with the request method.
Here is the relevant code:
let options = {
url: `/api/v2/tickets/${ticketID}.json`,
type: 'PUT',
data: JSON.stringify({
ticket: {
comment: {
body: commentText,
public: false
}
}
})
};
client.request(options).then(...
When inspect the api call in the browser I'm getting a 200 response but no comment added. I'm noticing a x-zendesk-api-warn field in the response header, which in browsing other posts indicates I'm not allowed to update these fields. When I try the same call (with a token and full tenant url) in postman, the comment is added and there is no api-warn header field. Is this a restriction when calling the api internally in the app framework? Is there another way I could accomplish this?
-
I figured out my issue. I saw this post and noticed it had
contentType: "application/JSON" added to the request options. Once I added this to my options it behaved as I was hoping. -
Hi Bruce,
Glad to hear you've got it working!
Have a great day :)
Tipene
Please sign in to leave a comment.
2 Comments