# 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](http://localhost:8080/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](http://localhost:8080/ws/rest/Remark/244324058)\
BODY:

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.dataloy.com/dataloy-rest-api/attachments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
