Fetching Records

The API automatically creates resources for each content type that is defined within your content model.

For example, if we defined a book content type then a resource called book would be created along with the following routes:

  • /book
  • /book/:id

The first route would be used when fetching multiple books, with the second route being used to fetch a book with a specific ID.

Fetching a Single Record

If you wanted to retrieve a specific book which had an ID of 1234, you would send the following request:

GET /book/1234
curl https://{SPACE_ID}.spaces.lexascms.com/delivery/jsonapi/book/1234 \
     -H 'Content-Type: application/vnd.api+json'

Fetching Multiple Records

In the event that you wanted to retrieve multiple books, you would send the following request:

GET /book
curl https://{SPACE_ID}.spaces.lexascms.com/delivery/jsonapi/book \
     -H 'Content-Type: application/vnd.api+json'

If the resources that you are requesting have any relationships, you can include any related resources by specifying the include parameter.

This allows you to reduce the number of requests that you need to make but also increases your requests complexity score. For more information about complexity scores, please see the query complexity section.

The include parameter accepts a comma separated list of relationship fields which should be included. You can also use dot-notation to include nested relationships.

The below example requests a specific book, including the author relationship field and the author’s image relationship field.

GET /book/1234
curl https://{SPACE_ID}.spaces.lexascms.com/delivery/jsonapi/book/1234?include=author,author.image \
     -H 'Content-Type: application/vnd.api+json'
Integrates with your favourite tools and frameworks

© 2022 Status200 Ltd.