API ReferenceContent

Blogs

Blogs, their posts and the comments on posts, read by id or by URL.

Blogs in Postman

About blogs

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.

Posts Yes

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 types
Revisions No

The blog record has no revisions; a change applies at once. Its posts are versioned.

Revisions, publishing and approval
Custom URLs Yes

A blog can take a custom URL instead of its slug path, and its posts follow under it.

Taxonomy, URLs and SEO
Languages Yes

A translated blog is its own record, linked to the one it translates through sourceBlog.

Multi-brand and languages
Custom fields No

Blogs have no custom fields.

Custom fields

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#

GET /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 compare totalCount with the unfiltered list's to confirm a filter applied.
orderByquery
string
field:ASC or field:DESC, comma-separated. Stored fields only.
limitquery
integer
Records per response. There is no default.
offsetquery
integer
Records to skip.

Example

List blogs
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
Response 200 OK
{
  "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"
    }
  ]
}
Open in Postman docs Real response from this documentation site

Show a blog#

GET /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

Show a blog
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
Response 200 OK
{
  "result": "success",
  "data": {
    "id": 5,
    "name": "How-to library",
    "slug": "how-to",
    "fullPath": "/how-to"
  }
}
Open in Postman docs Real response from this documentation site

Show a blog by its URL#

GET /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

Show a blog by its URL
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
Response 200 OK
{
  "result": "success",
  "data": {
    "id": 5,
    "name": "How-to library",
    "slug": "how-to",
    "fullPath": "/how-to"
  }
}
Open in Postman docs Real response from this documentation site

Create a blog#

POST /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

Create a blog
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
}
Response 200 OK
{
  "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."
}
Open in Postman docs Saved response from the Postman collection, shortened

Edit a blog#

PUT /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

Edit a blog
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"
}
Response 200 OK
{
  "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."
}
Open in Postman docs Saved response from the Postman collection, shortened

Delete a blog#

DELETE /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 a blog
DELETE /cdna-api/blogs/blog/3 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response 200 OK
{
  "result": "success",
  "data": [],
  "message": "The Blog has successfully been deleted."
}
Open in Postman docs Saved response from the Postman collection

Check that a blog slug is free#

POST /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

Check that a blog slug is free
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"
}
Response 200 OKIn use
{
  "result": "error",
  "message": "A record with this slug already exists"
}
Real response from this documentation site

In Blogs