Перейти до вмісту

REST API довідник

Ці API дозволяють клієнтам читати, додавати, редагувати і видаляти вміст веб-сайту (таблиці в схемі site), такі як статті, пункти меню тощо.

Перегляньте API параметри для отримання більше інформації про параметри.

MethodEndpointDescription
GET/cms-content/:slugОтримати вміст за слагом
GET/cms/:typeОтримати весь вміст
GET/cms/:type/:idОтримати конкретний вміст за ID
POST/cms/:type/:id?Створити новий вміст
PUT/cms/:type/:idОновити існуючий вміст
DELETE/cms/:type/:idВидалити вміст

Отримати вміст за слагом

Section titled “Отримати вміст за слагом”

Цей API дозволяє отримати вміст за слагом. (див. API параметри)

GET /api/cms-content/novina-1

Відповідь: 200 OK

{
"content_type_id": "0ccb6c1d5b15",
"type": "collection",
"table": "news",
"title": "Новини",
"status": "draft",
"slug": "news",
"columns": [
{
"name": "title",
"label": "Title",
"type": "text",
"required": true
},
// ...
],
"custom": true,
"rows": [
{
"id": "8c16854ca914",
"slug": "novina-1",
"title": "Новина 1",
"status": "draft",
"published_at": "2025-07-10 00:00:00",
"meta": null,
"created_at": "2025-07-08 09:18:12.017539",
"updated_at": "2025-07-08 09:18:12.017539",
"created_by": null,
"updated_by": "2025-07-08 09:18:12.017539+03"
}
]
}

Цей API дозволяє отримати весь вміст по типу контенту. (див. API параметри)

GET /api/cms/news

Відповідь: 200 OK

{
"time": {
// ...
},
"total": 2,
"filtered": 2,
"count": 2,
"pk": "id",
"rows": [
{
"id": "c75763dc8ee7",
"slug": "demo",
"title": "demo",
"status": "draft",
"published_at": "2025-07-08 00:00:00",
"meta": null,
"created_at": "2025-07-07 15:58:49.361299",
"updated_at": "2025-07-07 15:58:49.361299",
"created_by": "1",
"updated_by": "1"
},
{
"id": "8c16854ca914",
"slug": "novina-1",
"title": "Новина 1",
"status": "draft",
"published_at": "2025-07-10 00:00:00",
"meta": null,
"created_at": "2025-07-08 09:18:12.017539",
"updated_at": "2025-07-08 09:18:12.017539",
"created_by": null,
"updated_by": "2025-07-08 09:18:12.017539+03"
}
]
}

Отримати конкретний вміст за ID

Section titled “Отримати конкретний вміст за ID”

Цей API дозволяє отримати конкретний вміст за ID. (див. API параметри)

GET /api/cms/news/8c16854ca914

Відповідь: 200 OK

{
"time": {
// ...
},
"total": 1,
"filtered": 1,
"count": 1,
"pk": "id",
"rows": [
{
"id": "8c16854ca914",
"slug": "novina-1",
"title": "Новина 1",
"status": "draft",
"published_at": "2025-07-10 00:00:00",
"meta": null,
"created_at": "2025-07-08 09:18:12.017539",
"updated_at": "2025-07-08 09:18:12.017539",
"created_by": null,
"updated_by": "2025-07-08 09:18:12.017539+03"
}
],
"meta": {
"title": "SEO title",
"description": "SEO description",
"keywords": "SEO keywords"
},
"columns": [
{
"name": "title",
"label": "Title",
"type": "text",
"required": true
},
// ...
],
"filters": [],
"preview_path": null,
"custom": true
}

Цей API дозволяє створити новий вміст. (див. API параметри)

POST /api/cms/news
Content-Type: application/x-www-form-urlencoded

Відповідь: 201 Created

{
"id": "3092989176618943940",
"rows": [
{
"id": "3092989176618943940",
"slug": "test-slug",
"title": "Test article",
"status": "published",
"publish_at": "2025-05-18 00:00:00",
"meta_title": null,
"meta_description": null,
"meta_keywords": null,
"created_at": "2025-05-18 00:00:00",
"updated_at": "2025-06-18 12:52:28.940979",
"created_by": "1",
"updated_by": "1",
"description": null,
"image": "/files/uploads/2025-05-10/fbd4da55-fe03-4d67-b883-e3f7ec536d82.png",
"tags": [
"CMS",
"API",
"REST"
],
"body": "Brief description of the article",
"category": null,
"meta": null
},
],
}

Оновити існуючий вміст

Section titled “Оновити існуючий вміст”

Цей API дозволяє оновити існуючий вміст. (див. API параметри)

PUT /api/cms/news/3092989176618943940
Content-Type: application/x-www-form-urlencoded

Відповідь: 200 OK

{
"id": "3092989176618943940",
"slug": "test-slug",
"title": "Test article",
"status": "published",
"publish_at": "2025-05-18 00:00:00",
"meta_title": null,
"meta_description": null,
"meta_keywords": null,
"created_at": "2025-05-18 00:00:00",
"updated_at": "2025-06-18 12:52:28.940979",
"created_by": "1",
"updated_by": "1",
"description": null,
"image": "/files/uploads/2025-05-10/fbd4da55-fe03-4d67-b883-e3f7ec536d82.png",
"tags": [
"CMS",
"API",
"REST"
],
"body": "Brief description of the article",
"category": null,
"meta": null
}

Цей API дозволяє видалити вміст. (див. API параметри)

DELETE /api/cms/news/b47a9937401f

Відповідь: 200 OK

{
"id": "b47a9937401f",
"rowCount": 1,
"slug": "test",
"title": "test",
"status": "draft",
"published_at": "2025-07-07 00:00:00",
"meta": null,
"created_at": "2025-07-07 15:56:00.222623",
"updated_at": "2025-07-07 15:56:00.222623",
"created_by": null,
"updated_by": "2025-07-07 15:56:00.222623+03"
}