A blog is a container: it has a name, a slug, a layout for itself and a layout for its posts, and the posts live under it. The blog itself keeps no revisions; its posts do, and they have their own page.
API ReferenceContent
Blogs
Blogs, their posts and the comments on posts, read by id or by URL.
About blogs
A blog holds posts, each with its own revisions, authors, categories and tags. Posts are read and written on their own routes.
The built-in content typesThe blog record has no revisions; a change applies at once. Its posts are versioned.
Revisions, publishing and approvalA blog can take a custom URL instead of its slug path, and its posts follow under it.
Taxonomy, URLs and SEOA translated blog is its own record, linked to the one it translates through sourceBlog.
Key fields
id- integer
- The blog id.
name- string
- The blog name.
slug- string
- The blog's path segment.
fullPath- string
- The path on the site, honouring a custom URL. Computed.
layout- Layout
- The layout the blog page renders with.
postsLayout- Layout
- The layout its posts render with.
posts- Post[]
- The posts in the blog.
categories, tags- list
- The blog's taxonomy.
List blogs#
/cdna-api/blogs/blogs
Lists blogs. Without limit every match comes back.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Blog, in the Reference
Parameters
propertiesquery- selector
- The fields and relations to return, such as
{id,name,slug,fullPath}. filtersquery- name=value
- Any stored field, or a relation with a dot, such as
parent.id=12. Prefix the name with!,>,<,%or|. Use stored field names exactly as in the model, and comparetotalCountwith the unfiltered list's to confirm a filter applied. orderByquery- string
field:ASCorfield:DESC, comma-separated. Stored fields only.limitquery- integer
- Records per response. There is no default.
offsetquery- integer
- Records to skip.
Example
GET /cdna-api/blogs/blogs?limit=2&properties={id,name,slug,fullPath} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json{
"result": "success",
"totalCount": 2,
"data": [
{
"id": 4,
"name": "Core dna Hub Blog",
"slug": "hub-blog",
"fullPath": "/hub-blog"
},
{
"id": 5,
"name": "How-to library",
"slug": "how-to",
"fullPath": "/how-to"
}
]
}Show a blog#
/cdna-api/blogs/blog/{id}
Reads one blog by its id.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Blog, in the Reference
Parameters
idpathrequired- integer
- The blog id.
propertiesquery- selector
- The fields and relations to return, such as
{id,name,slug,fullPath}.
Example
GET /cdna-api/blogs/blog/5?properties={id,name,slug,fullPath} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json{
"result": "success",
"data": {
"id": 5,
"name": "How-to library",
"slug": "how-to",
"fullPath": "/how-to"
}
}Show a blog by its URL#
/cdna-api/blogs/blog/{slug}
Finds a blog by its path, the way the public site does: a custom URL first, then the slugs.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Blog, in the Reference
Parameters
slugpathrequired- string
- The blog slug.
propertiesquery- selector
- The fields and relations to return, such as
{id,name,slug,fullPath}.
Example
GET /cdna-api/blogs/blog/how-to?properties={id,name,slug,fullPath} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json{
"result": "success",
"data": {
"id": 5,
"name": "How-to library",
"slug": "how-to",
"fullPath": "/how-to"
}
}Create a blog#
/cdna-api/blogs/blog
Creates a blog.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
namebody- string
- The name.
layoutbody- number
- The layout, by id or identifier.
postsLayoutbody- number
- The layout the blog’s posts render with, by id.
authorbody- number
- The author, by id.
Example
POST /cdna-api/blogs/blog HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"name": "New blog from API",
"layout": 10,
"postsLayout": 11,
"author": 1
}{
"result": "success",
"data": {
"blog": {
"text": null,
"imageTargetFolderPath": "images/blogs/3",
"fullSlug": "new-blog-from-api",
"fullPath": "/blogs/new-blog-from-api",
"originalPath": "/blogs/new-blog-from-api",
"areas": [
43
],
"imageSelectorStartPath": "images/blogs/3",
"id": 3,
"name": "New blog from API",
"slug": "new-blog-from-api"
}
},
"message": "The Blog has been added successfully."
}Edit a blog#
/cdna-api/blogs/blog/{id}
Changes a blog. Fields left out keep their values.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
idpathrequired- integer
- The blog id.
namebody- string
- The name.
Example
PUT /cdna-api/blogs/blog/3 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"name": "Changed blog title"
}{
"result": "success",
"data": {
"blog": {
"text": null,
"imageTargetFolderPath": "images/blogs/3",
"fullSlug": "new-blog-from-api",
"fullPath": "/blogs/new-blog-from-api",
"originalPath": "/blogs/new-blog-from-api",
"areas": [
43
],
"imageSelectorStartPath": "images/blogs/3",
"id": 3,
"name": "Changed blog title",
"slug": "new-blog-from-api"
}
},
"message": "The Blog has been saved successfully."
}Delete a blog#
/cdna-api/blogs/blog/{id}
Deletes a blog.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
idpathrequired- integer
- The blog id.
Example
DELETE /cdna-api/blogs/blog/3 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json{
"result": "success",
"data": [],
"message": "The Blog has successfully been deleted."
}Check that a blog slug is free#
/cdna-api/blogs/check-blog-slug
Answers {"result":"success"} when no blog uses the slug. A slug in use, or one with characters a slug cannot have, answers HTTP 200 too, with "result": "error" and a message.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
slugbodyrequired- string
- The slug to check.
idbody- integer
- A record to leave out of the check, when renaming it.
sitebody- integer
- The site to check in.
Example
POST /cdna-api/blogs/check-blog-slug HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"slug": "how-to"
}{
"result": "error",
"message": "A record with this slug already exists"
}