Lists book pages. Without limit every match comes back.
Pages
Book pages, the leaf level of a book.
List book pages#
GET
/cdna-api/books/unit/{parent.id}/pages
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Page, in the Reference
Parameters
parent.idpathrequired- integer
- The unit id.
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.
retrieveUnpublishedquery- 1
- Include unpublished records.
Example
List book pages
GET /cdna-api/books/unit/1678/pages?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": 1,
"data": [
{
"id": 1684,
"name": "The REST API",
"slug": "rest-api",
"fullPath": "/books/apis/rest/rest-api"
}
]
}
Open in Postman docs Real response from this documentation site
List book pages across books#
GET
/cdna-api/books/pages
Lists book pages from every book. Filter it, for example with parent.parent.id for one book’s pages or owner for one user’s.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Page, 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.
retrieveUnpublishedquery- 1
- Include unpublished records.
Example
List book pages across books
GET /cdna-api/books/pages?parent.parent.id=1677&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": 6,
"data": [
{
"id": 1684,
"name": "The REST API",
"slug": "rest-api",
"fullPath": "/books/apis/rest/rest-api"
},
{
"id": 1685,
"name": "The GraphQL API",
"slug": "graphql",
"fullPath": "/books/apis/graphql-api/graphql"
}
]
}
Open in Postman docs Real response from this documentation site
Show a book page#
GET
/cdna-api/books/page/{id}
Reads one book page by its id.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Page, in the Reference
Parameters
idpathrequired- integer
- The book page id.
propertiesquery- selector
- The fields and relations to return, such as
{id,name,slug,fullPath}.
Example
Show a book page
GET /cdna-api/books/page/1684?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": 1684,
"name": "The REST API",
"slug": "rest-api",
"fullPath": "/books/apis/rest/rest-api"
}
}
Open in Postman docs Real response from this documentation site
Create a book page#
POST
/cdna-api/books/page
Creates a book page.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
unitbody- number
- The unit, by id.
revisionsbody- object
- A new revision:
name,layoutandareas, ortextfor a record with a body. Areas left out are empty.
Example
Create a book page
POST /cdna-api/books/page HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"unit": 80194,
"revisions": {
"name": "Extension pg 2",
"slug": "someslug1234567890"
}
}
Response
200 OK
{
"result": "success",
"data": {
"page": {
"unit": 9,
"id": 17,
"slug": "test-page-from-api-643",
"publishAt": null,
"unpublishAt": null,
"position": 8,
"created": "2019-03-15T14:57:41+00:00",
"modified": "2019-03-15T14:57:41+00:00",
"deleted": false,
"published": false
}
},
"message": "The Page has been added successfully."
}
Open in Postman docs Saved response from the Postman collection, shortened
Edit a book page#
PUT
/cdna-api/books/page/{id}
Changes a book page. Fields left out keep their values.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
idpathrequired- integer
- The book page id.
revisionsbody- object
- A new revision:
name,layoutandareas, ortextfor a record with a body. Areas left out are empty.
A revisions object makes a new revision that is not live unless the request also sends "activeRevision": true, and it holds only the areas sent. To change some areas and keep the rest, use patchRevision with originRevision.
Example
Edit a book page
PUT /cdna-api/books/page/24367 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"revisions": {
"name": "Test changed page from API 134",
"layout": 15,
"areas": {
"main": [
{
"id": 673386
},
{
"id": 2,
"global": true
}
]
}
}
}
Response
200 OK
{
"result": "success",
"data": {
"page": {
"id": 17,
"newRevision": 432
}
},
"message": "The Page has been saved successfully."
}
Open in Postman docs Saved response from the Postman collection
Delete a book page#
DELETE
/cdna-api/books/page/{id}
Deletes a book page.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
idpathrequired- integer
- The book page id.
Example
Delete a book page
DELETE /cdna-api/books/page/51 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response
200 OK
{
"result": "success",
"data": [],
"message": "The Page has successfully been deleted."
}
Open in Postman docs Saved response from the Postman collection
Check that a book page slug is free#
POST
/cdna-api/books/pages/check-slug
Answers {"result":"success"} when no book page 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. Slugs are unique per parent, so parent is required.
- 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.
parentbodyrequired- integer
- The parent the slug must be unique under.
sitebody- integer
- The site to check in.
Example
Check that a book page slug is free
POST /cdna-api/books/pages/check-slug HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"slug": "api-sandbox",
"parent": 1600
}