Timeline

Timeline is a feature by Contentful that allows you to create, schedule and preview multiple upcoming versions of the same digital experience.

Note: The Timeline feature is available on specific plans. For more information, reach out to your Sales representative.

To use the Timeline Preview feature, you can:

  1. Install the official contentful.js JavaScript library. Make sure you are on version v11.9.0 or higher.

Assuming the website logic is already updated to read the URL query parameters, all you need to do is pass those values when initializing the Contentful client, for example:

1import * as contentful from 'contentful'
2import { parseTimelinePreviewToken } from '@contentful/timeline-preview'
3
4// "timeline" value should be taken from the URL query param value configured in the "Create a preview platform" section above
5const { releaseId, timestamp } = parseTimelinePreviewToken(timeline)
6
7const client = contentful.createClient({
8 space: 'yadj1kx9rmg0',
9 host: 'preview.contentful.com',
10 // Provide either release or timestamp (or both maybe be passed if the release is scheduled) as a valid config
11 timelinePreview: {
12 release: { lte: releaseId },
13 timestamp: { lte: timestamp },
14 },
15 // ... any other options as normal
16})

The output client must be used in all subsequent requests to ensure a consistent preview experience.

  1. If you’re not using the official JavaScript client, you’ll need to configure your requests manually. When timeline preview is enabled, make sure all preview entry and asset requests are directed to the /timeline/ endpoints, and include the appropriate release and/or timestamp query parameters. See below for details.

Query entries using release ID

Retrieves entries across the timeline, similar to the Entries Collection endpoint. Entries are resolved across the timeline starting from the specified release, falling back to the previous scheduled release or the currently published version.

Get all entries

Query entries using timestamp

Retrieves entries across the timeline, similar to the Entries Collection endpoint. Entries are resolved across the timeline starting from the specified timestamp, falling back to the previous scheduled release or the currently published version.

Get all entries

Fetch an entry using release ID

The equivalent of Entry endpoint for resolving content across the timeline.

Get an entry

Fetch an entry using timestamp

The equivalent of Entry endpoint for resolving content across the timeline.

Get an entry

Query assets using release ID

Retrieves assets across the timeline, similar to the Assets Collection endpoint. Assets are resolved across the timeline starting from the specified release, falling back to the previous scheduled release or the currently published version.

Get all assets

Query assets using timestamp

Retrieves assets across the timeline, similar to the Assets Collection endpoint. Assets are resolved across the timeline starting from the specified timestamp, falling back to the previous scheduled release or the currently published version.

Get all assets

Fetch an asset using release ID

The equivalent of Asset endpoint for resolving content across the timeline.

Get an asset

Fetch an asset using timestamp

The equivalent of Asset endpoint for resolving content across the timeline.

Get an asset