Skip to Content
Mutation APIFetching single items

Fetching single items

Use the Prepr REST API to fetch a single content item when you need to get specific content for a bulk process. For example, to get content from linked content items as part of a project to migrate content from a legacy system to Prepr CMS.

Use GraphQL API for content delivery

If you simply want to fetch a content item for content delivery then we strongly recommend using the GraphQL API instead.

Before calling a REST API endpoint to fetch a single content item, go to Settings → Access tokens to create an access token with the REST API scope content_items.

To fetch a content item, send a GET request to the https://cdn.prepr.io/content_items endpoint. There are two ways to fetch a single content item.

Query by Id

Since IDs are unique in Prepr, you can fetch the content item you want by its id.

The example below fetches one content item with the ID 535c1e-4d52-4794-9136-71e28f2ce4c1.

GET https://cdn.prepr.io/content_items/535c1e-4d52-4794-9136-71e28f2ce4c1 Authorization: Bearer <YOUR-ACCESS-TOKEN>

Query by Slug

Since slugs are unique within a content model, you can fetch a content item by its slug.

The example below fetches one Page content item with the slug nieuws/388107-beelden-paaseiland-wandelden-over-het-eiland.html.

GET https://cdn.prepr.io/content_items?slug[0][eq]=nieuws/388107-beelden-paaseiland-wandelden-over-het-eiland.html Authorization: Bearer <YOUR-ACCESS-TOKEN>

The example below fetches Page content items with a slug that starts with nieuws/388107.

GET https://cdn.prepr.io/content_items?slug[0][sw]=nieuws/388107 Authorization: Bearer <YOUR-ACCESS-TOKEN>
Last updated on