Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

How do I add an attachment in CS REST API?

Hi.

I am trying to add an attachment to CS using REST API. But according to the documentation I need an attachmentId to get an attachmentId?

https://community.superoffice.com/documentation/sdk/SO.NetServer.Web.Services/html/v1AttachmentEntity_PostAttachmentEntity.htm

I guess I should first Post and then use the Id I get to post content?

And then use the Id to add the attachment to the message?


Espen

RE: How do I add an attachment in CS REST API?

Hi,

If you omit this it should generate a new AttachmentId, like my example:

After this you need to upload actual content with /api/v1/Attachment/{attachmentId}/Content

Von: Michel Krohn-Dale 1. Feb 2021

RE: How do I add an attachment in CS REST API?

Hi Espen,

First you create the Attachment with /api/v1/Attachment

then you use the /api/v1/Attachment/{attachmentId}/Content to add the content to the specific Attachment.

 

In Postman I create an attachment like this (api/v1/Attachment/):

Then use api/v1/Attachment/82/Content to add the base64Encoded string in the body.

To add the attachment to a message (ticket), you will have to use:
/api/v1/TicketMessage/{ticketMessageEntityId}/Attachment

Hope this was helpful.

Von: Simen Mostuen Iversen 1. Feb 2021

RE: How do I add an attachment in CS REST API?

Thank you so much.

Attachments are now added :-)

 

Espen

Von: Espen Fosshaug 1. Feb 2021

RE: How do I add an attachment in CS REST API?

When uploading content, you only need to use base64 string if you specify content type "application/json".

If you specify content type "application/octet-stream" you can upload the file contents as-is.

 

Von: Christian Mogensen 2. Feb 2021