Files

Core Instance Files

Files from a core instance with backward pagination.

GEThttps://cloud-api.calyptia.com/v1/core_instances/{coreInstanceID}/files
Authorization
Path parameters
coreInstanceID*string (uuid)
Query parameters
Response

OK

Body
items*array of CoreInstanceFile (object)
endCursor*nullable string
count*number (int32)
Request
const response = await fetch('https://cloud-api.calyptia.com/v1/core_instances/{coreInstanceID}/files', {
    method: 'GET',
    headers: {
      "Authorization": "Bearer <token>"
    },
});
const data = await response.json();
Response
{
  "items": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "coreInstanceID": "123e4567-e89b-12d3-a456-426614174000",
      "name": "myfile",
      "contents": "Ynl0ZXM=",
      "encrypted": false,
      "createdAt": "2024-11-21T10:00:14.940Z",
      "updatedAt": "2024-11-21T10:00:14.940Z"
    }
  ],
  "endCursor": "text",
  "count": 0
}

Create Core Instance File

Create a new file within a core instance. The file will be created with the given name and content. If encypted is set to true, the file will be encrypted using the core instance's encryption key. The name must be unique among all files within the core instance.

POSThttps://cloud-api.calyptia.com/v1/core_instances/{coreInstanceID}/files
Authorization
Path parameters
coreInstanceID*string (uuid)
Body
name*string
Example: "myfile"
contents*string (byte)

The contents of the file to be created in base 64 format.

encrypted*boolean
Response

Created

Body
id*string (uuid)
createdAt*string (date-time)
Request
const response = await fetch('https://cloud-api.calyptia.com/v1/core_instances/{coreInstanceID}/files', {
    method: 'POST',
    headers: {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "name": "myfile",
      "contents": "Ynl0ZXM=",
      "encrypted": false
    }),
});
const data = await response.json();
Response
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "createdAt": "2024-11-21T10:00:14.940Z"
}