HTML block contents (Code partials)
Summary of code partial contents endpoints
- GET /admin/api/code_partials - list all available HTML block contents for the current site.
- GET /admin/api/code_partials/1 - get data for a single HTML block content.
- PUT /admin/api/code_partials/1 - update attributes of an HTML block content.
List all available HTML block contents for the current site
GET /admin/api/code_partials
Example response:
Status: 200 OK
[
{
"id": 1,
"created_at": "2026-03-25T14:58:26.000Z",
"updated_at": "2026-03-25T14:58:26.000Z",
"url": "http://helloworld.voog.co/admin/api/code_partials/1",
"content": {
"id": 1,
"name": "body",
"created_at": "2026-03-25T14:58:26.000Z",
"updated_at": "2026-03-25T14:58:26.000Z",
"position": 1,
"url": "http://helloworld.voog.co/admin/api/pages/1/contents/1"
},
"parent": {
"id": 1,
"title": "Home page",
"created_at": "2026-03-25T14:58:26.000Z",
"updated_at": "2026-03-25T14:58:26.000Z",
"type": "page",
"url": "http://helloworld.voog.co/admin/api/pages/1"
}
}
]
Parameters
per_page- elements per response (default:50; maximum:250).page- requested page (default:1).parent_id- filter by parent ID (requiresparent_type).parent_type- filter by parent type (requiresparent_id). Allowed values:page,language,article,product.
Filter attributes
Read more about filters.
- Object
code_partialattributes:id,body,created_at,updated_at. - Object
contentattributes:id,parent_id,language_id,content_id,content_type,page_id,page_type,name,position,created_at,updated_at.
Get data for a single HTML block content
GET /admin/api/code_partials/1
Example response:
Status: 200 OK
{
"id": 1,
"created_at": "2026-03-25T14:58:26.000Z",
"updated_at": "2026-03-25T14:58:26.000Z",
"url": "http://helloworld.voog.co/admin/api/code_partials/1",
"content": {
"id": 1,
"name": "body",
"created_at": "2026-03-25T14:58:26.000Z",
"updated_at": "2026-03-25T14:58:26.000Z",
"position": 1,
"url": "http://helloworld.voog.co/admin/api/pages/1/contents/1"
},
"parent": {
"id": 1,
"title": "Home page",
"created_at": "2026-03-25T14:58:26.000Z",
"updated_at": "2026-03-25T14:58:26.000Z",
"type": "page",
"url": "http://helloworld.voog.co/admin/api/pages/1"
},
"body": "<div><h1>Hello World</h1></div>",
"content_mode": "html",
"content_size": 31,
"is_full_page": false
}
Update an HTML block content
PUT /admin/api/code_partials/1
Updates the body of an HTML block. The is_full_page flag is automatically detected based on the presence of a <html>...</html> wrapper.
Example request:
{
"body": "<html><head><title>My Page</title></head><body><h1>Hello</h1></body></html>"
}
Example response:
Status: 200 OK
{
"id": 1,
"created_at": "2026-03-25T14:58:26.000Z",
"updated_at": "2026-03-25T15:00:00.000Z",
"url": "http://helloworld.voog.co/admin/api/code_partials/1",
"content": {
"id": 1,
"name": "body",
"created_at": "2026-03-25T14:58:26.000Z",
"updated_at": "2026-03-25T15:00:00.000Z",
"position": 1,
"url": "http://helloworld.voog.co/admin/api/pages/1/contents/1"
},
"parent": {
"id": 1,
"title": "Home page",
"created_at": "2026-03-25T14:58:26.000Z",
"updated_at": "2026-03-25T14:58:26.000Z",
"type": "page",
"url": "http://helloworld.voog.co/admin/api/pages/1"
},
"body": "<html><head><title>My Page</title></head><body><h1>Hello</h1></body></html>",
"content_mode": "html",
"content_size": 75,
"is_full_page": true
}
Parameters
body- HTML block body content. Can be an empty string. Maximum size is5MB.
Read-only attributes
content_mode- valuehtml.content_size- size of the body content in bytes (calculated automatically).is_full_page- whether the content is a full HTML page (auto-detected based on the presence of a<html>...</html>wrapper).