Fetching content
The Content API is used to fetch content from Type CMS projects to your applications. This API is read-only and authorization is granted via project tokens that are attached to environments.
post
Fetches all entries matching a provided entry ID
Required attributes
projectId | string | Your project ID |
entryId | string | The ID of the entry you want to fetch |
Optional attributes
format | string | Must be "html" or null. Converts RTE content to HTML for you |
limit | number | Limits the number of entries returned |
skip | number | For pagination, the number of entries to skip |
sort | object | The field to sort on. For example, { createdAt: -1 } will sort results by publish datetime desc. |
Request
post
/api/projects/:projectId/content
Response
post
Fetches entries by their template. For example, grabbing all entries of template type "blog".
Required attributes
projectId | string | Your project ID |
type | string | The name of the template you want to fetch entries for |
Optional attributes
format, limit, skip, sort | See "Get entries by ID" |
Request
post
/api/projects/:projectId/content
Response
post
Fetches entries by a nested value.
Required attributes
projectId | string | Your project ID |
:nestedField | string | Object dot notation of nested field. Ex: content.tags |
Optional attributes
format, limit, skip, sort | See "Get entries by ID" |
Request
post
/api/projects/:projectId/content
Response
post
Fetches entries where multiple conditions are met. This approach further refines results. For example, if we want to fetch all blog posts with a specific tag we can pass both the blog type and nested tag value to fetch.
Required attributes
projectId | string | Your project ID |
Optional attributes
format, limit, skip, sort | See "Get entries by ID" |
Request
post
/api/projects/:projectId/content
Response
Last modified 7/6/2024, 5:26:23 PM