Attachings and Attachments APIs

These are APIs only available in the admin namespace.

Attachings API

Create attaching

POST http://gobierto.example/admin/attachments/api/attachings

You'll need to provide the following parameters inside the request body, formatted as JSON:

ParamterDescriptionAccepted values
attachment_idID of attachment
attachable_idID of attachable
attachable_typeAttachable type (class)'GobiertoCms::Page'

Example:

{
    "attachment_id": 1,
    "attachable_id": 2,
    "attachable_type": "GobiertoCms::Page"
}

Delete attaching

DELETE http://gobierto.example/admin/attachments/api/attachings

You'll need to provide the following parameters inside the request body, formatted as JSON:

ParamterDescriptionAccepted values
attachment_idID of attachment
attachable_idID of attachable
attachable_typeAttachable type (class)'GobiertoCms::Page'

Attachments API

Index Attachments

Retrieves a collection of attachments.

GET http://gobierto.example/admin/attachments/api/attachments

Optional parameters:

ParamterDescriptionAccepted values
pageUsed for pagination-
attachable_idUse combined attachable_type to get attachable attachments-
attachable_typeUse combined attachable_id to get attachable attachments'GobiertoCms::Page'
search_stringProvide string to search engine-

Create attachment

POST http://gobierto.example/admin/attachments/api/attachments

You'll need to provide the following parameters inside the request body, formatted as JSON (example):

{
    "attachment": {
        "name": "New attachment name",
        "description": "New attachment description",
        "file_name": "sample_file.txt",
        "file": "file content encoded in base64"
    }
}
  • Name and Description are optional

GET attachment

GET http://gobierto.example/admin/attachments/api/attachments/:id

You can provide the following parameters inside the request body, formatted as JSON (example):

{
    "attachment": {
        "name": "New attachment name",
        "description": "New attachment description",
        "file_name": "sample_file.txt",
        "file": "file content encoded in base64"
    }
}

Update attachment

PATCH http://gobierto.example/admin/attachments/api/attachments/:id

You can provide the following parameters inside the request body, formatted as JSON (example):

{
    "attachment": {
        "name": "New attachment name",
        "description": "New attachment description",
        "file_name": "sample_file.txt",
        "file": "file content encoded in base64"
    }
}

Delete attachment

DELETE http://gobierto.example/admin/attachments/api/attachments/:id