Question

Add attachments to event via API

  • 27 June 2023
  • 1 reply
  • 136 views

Userlevel 3
Badge +8
  • Sidekick (Customer)
  • 55 replies

Does anyone have an example of adding attachments to an event via the API?  I have the API working to create a new event and return the ID of the event, and I see some notes in the Wiki about how to post an attachment, but that info is very limited on how to actually do it. It only provides the following, with no further details:

<attachment>
    <name>REST ATTACHMENT</name>
    <attachment>iVBORw0KGgoAAAANSUhEUgAAAH0AAAA...</attachment>
    <fileName>assyst_logo_ano.png</fileName>
</attachment>

I get what the Name value should be and the filename, but what is the “attachment” value exactly? Is that the path to the file? Is that the file type? Not sure exactly what that is.

Thanks in advance.


1 reply

Badge

 Hi,

Its simple to understand with this image:

  • Name: Name as this file will be recorgnized on assyst
  • Filenane: The filename
  • Attachment: The base64 encoded of this attachment

 

  • The content of attachments is always Base64 Encoded to enable binary content to be transferred using JSON and XML formats.

https://wiki.axiossystems.com/assyst11-4Wiki/index.php/Integrations:assystREST_More_Examples#Attachments

 

This way you need to get the base64 encoded string from your attachment.

For tests purpose, you can get this code on online pages, as an example this online page can convert an image (png) to base64 (A very long string characters).

https://base64.guru/converter/encode/image

When you have it, you need only to put on “attachment” entry.

Reply