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.
If you wanted to retrieve a specific book which had an ID of 1234
, you would send the following request:
curl https://{SPACE_ID}.spaces.lexascms.com/delivery/jsonapi/book/1234 \
-H 'Content-Type: application/vnd.api+json'
In the event that you wanted to retrieve multiple books, you would send the following request:
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.
curl https://{SPACE_ID}.spaces.lexascms.com/delivery/jsonapi/book/1234?include=author,author.image \
-H 'Content-Type: application/vnd.api+json'
© 2022 Status200 Ltd.