How to put URL in comment by using api?
Hello,
I would like to put URL in comment by using api. Can anyone advise me how to do it?
I try using PUT method and add file_name and content_url in attachments as below but it doesn't work.
Attachment is still empty ("attachments":[])
Thanks
-
Hi Nida Patanarat. The Upload API doesn't support URL locations for adding attachments. While there is a "content_url" attribute associated with comment attachments, that is a read-only property that Zendesk Support populates with the location of the uploaded content.
The ability to upload content via a URL has been requested before but is currently not in the product. I hope that at least sets expectations, so you can determine next steps for your solution.
-
Hi Bryan,
Thanks for your clarification. Then I try to upload image file instead. The image can be uploaded but cannot be downloaded. I noticed that it may because thumbnails is null. Do you have any idea?
"attachments": [
{
"url": "https://nsquaredhelp1597637631.zendesk.com/api/v2/attachments/901097734586.json",
"id": 901097734586,
"file_name": "Chair.jpg",
"content_url": "https://nsquaredhelp1597637631.zendesk.com/attachments/token/tG78vs98rU9Ajc9VwdcnAppy5/?name=Chair.jpg",
"mapped_content_url": "https://nsquaredhelp1597637631.zendesk.com/attachments/token/tG78vs98rU9Ajc9VwdcnAppy5/?name=Chair.jpg",
"content_type": "image/jpeg",
"size": 28,
"width": null,
"height": null,
"inline": false,
"deleted": false,
"thumbnails": []
}
],
Below is when I get token from api via postman.
Thanks,
Nida
-
You mention "The image can be uploaded but cannot be downloaded" but the Postman screen shot above is of a POST operation. A GET request is needed to retrieve an attachment using /api/v2/attachments/{id}.json. Can you let me know if I'm missing something Nida Patanarat?
Please sign in to leave a comment.
3 Comments