Skip to content

/system/blobs/:id/attachments

Path: /system/blobs/:id/attachments

Namespace: system

Parent Resource: blobs

Overview

Attachments represent files attached to a blob. Each attachment contains file information, metadata, and content.

Available Operations

List Attachments (GET)

Endpoint: GET /system/blobs/:id/attachments.json

Description: Retrieve all attachments for a specific blob.

Request Example:

bash
GET /system/blobs/123/attachments.json

Response (200 OK):

json
{
  "attachments": [
    {
      "id": 1,
      "blob_id": 123,
      "filename": "document.pdf",
      "content_type": "application/pdf",
      "file_size": 102400
    }
  ]
}

Show Attachment (GET /:id)

Endpoint: GET /system/blobs/:id/attachments/:id.json

Description: Retrieve a specific attachment.

Request Example:

bash
GET /system/blobs/123/attachments/1.json

Response (200 OK):

json
{
  "attachment": {
    "id": 1,
    "blob_id": 123,
    "filename": "document.pdf",
    "content_type": "application/pdf",
    "file_size": 102400
  }
}

Create Attachment (POST)

Endpoint: POST /system/blobs/:id/attachments.json

Description: Create a new attachment for a blob.

Request Example:

bash
POST /system/blobs/123/attachments.json
Content-Type: multipart/form-data

{
  "attachment": {
    "file": "<file_data>",
    "filename": "new_document.pdf"
  }
}

Response (201 Created):

json
{
  "attachment": {
    "id": 2,
    "blob_id": 123,
    "filename": "new_document.pdf"
  }
}

Update Attachment (PATCH /:id)

Endpoint: PATCH /system/blobs/:id/attachments/:id.json

Description: Update an existing attachment.

Request Example:

bash
PATCH /system/blobs/123/attachments/1.json
Content-Type: application/json

{
  "attachment": {
    "filename": "updated_document.pdf"
  }
}

Response (200 OK):

json
{
  "attachment": {
    "id": 1,
    "filename": "updated_document.pdf"
  }
}

Delete Attachment (DELETE /:id)

Endpoint: DELETE /system/blobs/:id/attachments/:id.json

Description: Delete an attachment.

Request Example:

bash
DELETE /system/blobs/123/attachments/1.json

Response (204 No Content)

Batch Actions (POST /batch_action)

Endpoint: POST /system/blobs/:id/attachments/batch_action.json

Description: Perform batch operations on selected attachments.

Request Example:

bash
POST /system/blobs/123/attachments/batch_action.json
Content-Type: application/json

{
  "batch_action": "delete",
  "collection_selection": [1, 2, 3]
}

Response (200 OK):

json
{
  "message": "Batch action completed",
  "affected_count": 3
}

Released under an open source license.