Content API

Out of the box, Burdy offers 4 main APIs.

Get Post Content

To retrieve posts or pages you can use /api/content/<slugPath>. Slug path represents a full slug including ancestors path to some post or page.

For example:

  • if page doesn't have parent and its slug is test, content will be available at /api/content/test endpoint.
  • If page with a slug getting-started does have parent with slug docs, content can be found at /api/content/docs/getting-started endpoint.
Query params

draft boolean - (optional) - default false

If set to true, will retrieve post that is not published


versionId number | string - (optional)

A historical version of the post


relationsDepth number | string - (optional) - default 3

To which depth should post compile relations, both single and multiple.


x-content-token string

Token that is generated by Burdy and allows clients to access content

Search Posts

To be able to build amazing sitemaps and search content we provide an advanced search API that allows apps to fetch list of posts by different criteria.

Endpoint: /api/search/posts

Query params

draft boolean - default false

If set to true, will retrieve posts that are either published or in draft state


type string - multiple comma-separated - default page,hierarchical_page,post

Type of the posts which should be returned.

Possible values: page, hierarchical_page, post, folder, fragment


contentTypeName string - multiple comma-separated

Name of the post content type


search string

Searches post that contains search string in either name or a slug


parent string

slugPath of the parent under which it should do the search


onlyOrphans boolean | string

It will retrieve posts that are direct children to either parent if parent is provided or in root of the sites


slugPath string - comma-separated for multiple

slugPath of the posts


tags string - multiple comma-separated

Searches if post has any of the tags slugPaths provided. If provided will expand tags of the posts.


expand string - comma-separated for multiple

Expands and joins other tables

Possible values - tags,contentType,meta,author,parent


compile string | boolean

If retrieved posts should be compiled, all assets and relations joined and meta retrieved in object form


relationsDepth number | string - (optional) - default 0

To which depth should post compile relations, both single and multiple. This field will only take effect if compile is set to true


orderBy string - default createdAt

Orders posts by any of the post fields such as post.createdAt, post.updatedAt, post.slugPath etc.


order string - default ASC

In which order should posts be ordered. Possible values ASC, DESC


limit string | number - default 100

Used for pagination, will retrieve up to a provided number of posts


page string | number - default 1

Used for pagination, represents page number of the retrieved set of posts


x-content-token string - required

Token that is generated by Burdy and allows clients to access content

This API is only callable with valid access token provided either in Header or in query param /api/search/posts?x-content-token=<token>

Search Tags

Similar to posts we provide a search API that allows apps to fetch a list of tags by different criteria.

Endpoint: /api/search/tags

Query params

draft boolean - default false

If set to true, will retrieve posts that are either published or in draft state


search string

Searches post that contains search string in either name or a slug


parent string - multiple comma-separated

slugPath of the parent under which it should do the search


onlyOrphans boolean | string

It will retrieve tags that are direct children to either parent if a parent is provided or in the root of the tags


slugPath string - comma-separated for multiple

slugPath of the tags


expand string - comma-separated for multiple

Expands and joins other tables

Possible values - parent


orderBy string - default createdAt

Orders posts by any of the post fields such as tag.createdAt, tag.updatedAt, tag.slugPath etc.


order string - default ASC

In which order should posts be ordered. Possible values ASC, DESC


limit string | number - default 100

Used for pagination, will retrieve up to a provided number of posts


page string | number - default 1

Used for pagination, represents page number of the retrieved set of posts


x-content-token string - required

Token that is generated by Burdy and allows clients to access content

This API is only callable with valid access token provided either in header of the request (x-content-token) or in query param /api/search/tags?x-content-token=<token>

Get Asset

Similarly to posts and pages, to retrieve the content of the assets use endpoint /api/uploads/<npath>. Npath represents the full named path to some asset.

For example:

  • if an asset is in the root folder and its name is image.png, the content will be available at /api/uploads/image.png endpoint.
  • if asset image.png is in folder Images, the content will be available at /api/uploads/Images/image.png endpoint.

Custom

To retrieve any post or asset by any criteria you can easily add a new backend endpoint using our hooks and using the TypeORM repository or entityManager to retrieve items from the database.

Copyright © Burdy Technologies. All rights reserved.