Attachments

Since API 3.3 Remark has a new attribute attachments that contains a list of Attachment objects. The Attachment resource has an attribute called file where can be stored the content of the file encoded in Base64.

The attribute fileName is mandatory, the attribute "filesize" is not mandatory but the client should pass it.

The two resources can be manipulated exactly as all other resources.

When a new Remark is posted with attachments in the JSON the source field must be before the attachments field.

When getting an attachment, data can be encoded in base64, but also unencoded. Attachments added from the API will be encoded and attachment added from the Java VMS client may be unencoded.

Some examples

Create a new remark with a file attached:

POST: http://{URL}/ws/rest/Remark BODY:

{
  "remarkTitle": "test 1",
  "source": 19637583,
  "attachments": [
    {
      
      "file":"small file 1",
      "fileName":"test1.txt"
    }
  ]
}

Attach an Attachment to an existing Remark

PUT: http://{URL}/ws/rest/Remark/244324058 BODY:

{
  "attachments": [
    {
      "file":"small file 2",
      "fileName":"test2.txt"
    }
  ]
}

Last updated