Client initialization parameters
+Global library settings
+getGlobalSettings - Method returning client settings
++ + + +
+Contentful.js is a JavaScript and TypeScript library for the Contentful Content Delivery API and Content Preview API.
+The code is documented using TypeDoc and these pages are auto-generated and published with each new version.
+Assets are binary files in a Contentful space
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+If provided for a client using allLocales
modifier, response type defines locale keys for asset field values.
Definition of a content type
+Definition of a content type field
+Definition of a single validation rule applied +to the related content type field
+Optional
enabledOptional
inOptional
linkOptional
linkOptional
messageOptional
nodesOptional
regexpOptional
sizeOptional
uniqueSystem managed metadata for content type
+Contentful Delivery API Client. Contains methods which allow access to the different kinds of entities present in Contentful (Entries, Assets, etc).
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+The current Contentful.js version
+A client that will fetch assets and entries with all locales. Only available if not already enabled.
+A client that will not resolve links in entries. Only available if not already disabled.
+A client that will remove unresolvable links from entries. Only available if not already disabled.
+Fetches a collection of assets
+Optional
query: AssetsQueries<AssetFields, Modifiers>Object with search parameters
+Promise for a collection of Assets
+Fetches a content type
+The content type’s ID
+Promise for a content type
+Fetches a collection of content types
+Optional
query: { Optional
query?: stringPromise for a collection of content types
+Fetches a collection of Entries
+Shape of entry fields used to calculate dynamic keys
+If provided for a client using allLocales
modifier, response type defines locale keys for entry field values.
Optional
query: EntriesQueries<EntrySkeleton, Modifiers>Object with search parameters
+Promise for a collection of Entries
+Fetches an entry
+Shape of entry fields used to calculate dynamic keys
+If provided for a client using allLocales
modifier, response type defines locale keys for entry field values.
The entry’s ID
+Optional
query: EntryQueries<Modifiers>Object with search parameters. In this method it's only used for locale
when querying.
Promise for an entry
+Fetches a collection of locales
+Promise for a collection of locales
+Gets a collection of Tags
+Optional
query: TagQueriesPromise for a collection of tags
+Parse raw json data into a collection of entries. objects.Links will be resolved also
+Shape of entry fields used to calculate dynamic keys
+If provided for a client using allLocales
modifier, response type defines locale keys for entry field values.
json data
+const data = {items: [
{
sys: {type: 'Entry', locale: 'en-US'},
fields: {
animal: {sys: {type: 'Link', linkType: 'Animal', id: 'oink'}},
anotheranimal: {sys: {type: 'Link', linkType: 'Animal', id: 'middle-parrot'}}
}
}
],
includes: {
Animal: [
{
sys: {type: 'Animal', id: 'oink', locale: 'en-US'},
fields: {
name: 'Pig',
friend: {sys: {type: 'Link', linkType: 'Animal', id: 'groundhog'}}
}
}
]
}
}
console.log( data.items[0].fields.foo ); // undefined
const parsedData = client.parseEntries(data);
console.log( parsedData.items[0].fields.foo ); // foo
+
+
+Synchronizes either all the content or only new content since last sync. + Important note: The Sync API endpoint does not support include or link resolution. +However, contentful.js can do link resolution on the client side for the initial sync. +For the delta sync (using nextSyncToken) link resolution is not possible since the sdk won’t have access to all linked entities.
+Shape of entity fields used to calculate dynamic keys
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+If provided for a client using allLocales
modifier, response type defines locale keys for entity field values.
Query object
+Optional
syncOptions: SyncOptionsimport * as contentful from 'contentful'
const client = contentful.createClient({
space: '<space_id>',
accessToken: '<content_delivery_api_key>'
})
const response = await client.sync({
initial: true
})
console.log({
entries: response.entries,
assets: response.assets,
nextSyncToken: response.nextSyncToken
})
+
+
+Client initialization parameters
+Contentful CDA Access Token
+Optional
adapterOptional axios request adapter (see axios docs )
+Optional
alphaEnable alpha features.
+Optional
applicationApplication name and version e.g myApp/version
+Optional
basePath appended to the host to support gateways/proxies with custom urls
+Optional
environmentContentful Environment ID
+Optional
headersOptional additional headers
+Optional
hostAPI host. Also usable with preview.contentful.com.
+Optional
httpOptional Node.js HTTP agent for proxying +(see Node.js docs +and https-proxy-agent)
+Optional
httpsOptional Node.js HTTP agent for proxying +(see Node.js docs +and https-proxy-agent)
+Optional
includeEnable Content Source Maps.
+Optional
insecureRequests will be made over http instead of the default https
+Optional
integrationIntegration name and version e.g react/version
+Optional
logA log handler function to process given log messages and errors. +(The default can be found at: https://github.com/contentful/contentful-sdk-core/blob/master/src/create-http-client.ts)
+Log level, e.g. error, warning, or info
+Optional
data: string | Record<string, any>Log data
+Optional
proxyOptional Axios proxy (see axios docs )
+Optional
requestInterceptor called on every request. Takes Axios request config as an arg.
+Optional
responseInterceptor called on every response. Takes Axios response object as an arg.
+Optional
retryOptional number of retries before failure.
+Optional
retryIf we should retry on errors and 429 rate limit exceptions
+Space ID
+Optional
timeoutconnection timeout in milliseconds (default:30000)
+System managed metadata for entities
+Optional
contentOptional
contentOptional
localeSystem managed metadata for entries
+Optional
contentOptional
contentOptional
localeDefinition of an item belonging to the content type field
+Optional
nextOptional
nextSystem managed metadata for tags
+Optional
contentOptional
contentDefinition of abstract entry field types with additional type properties +Introduced to properly distinguish all fields to create consistent query types
+Internal
Adds a modifier to a list of client chain modifiers.
+A collection of assets
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+If provided for a client using allLocales
modifier, response type defines locale keys for asset field values.
All queries appliable to asset file details fields
+All queries appliable to asset file fields
+All queries appliable to asset fields
+Shape of asset fields used to calculate dynamic keys
+Internal
Order in an asset
+Search parameters for a single asset methods
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+Internal
Select fields in an asset
+Search parameters for asset collection methods
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+Mapping between abstract entry field types with additional type information +and entry field types
+Internal
within - location in a bounding object in provided fields
+Internal
Client chain modifiers used in all types that depend on the client configuration.
+Collection of content types
+System managed metadata for deleted assets
+System managed metadata for deleted entries
+Search parameters for entry collection methods
+Shape of an entry used to calculate dynamic keys
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+Entry represents anything defined as a Content Type in a space
+Shape of entry fields used to calculate dynamic keys
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+If provided for a client using allLocales
modifier, response type defines locale keys for entry field values.
A collection of entries
+Shape of entry fields used to calculate dynamic keys
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+If provided for a client using allLocales
modifier, response type defines locale keys for entry field values.
All possible values for entry field types
+All possible values for entry field types with additional type properties
+Internal
Equality filters in provided fields of an entry - search for exact matches
+Internal
Check for existence of provided fields in an entry
+Internal
match - full text search in provided fields of an entry
+Internal
Inequality filters in provided fields of an entry - exclude matching items
+All queries applicable to entry fields
+Shape of entry fields used to calculate dynamic keys
+Internal
Range operators appliable to date and number fields in an entry
+Internal
Match multiple values in provided fields of an entry
+Internal
Subset filters for inclusion & exclusion in provided fields of an entry
+Internal
Order in an entry
+Internal
Order for provided fields in an entry
+Search parameters for a single entry methods
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+Internal
Select fields in an entry
+Internal
Select fields from provided fields in an entry
+Internal
Check for existence of provided fields
+Internal
match - full text search in provided fields
+Internal
Location search
+User-controlled metadata
+All queries applicable to metadata concepts fields
+All queries applicable to metadata tags fields
+Internal
near - location proximity search in provided fields
+Internal
A single resolved link to another asset
+If the current client configuration includes withoutLinkResolution
chain option,
+the returned type will not resolve linked entities, but keep them as objects
+If the current client configuration includes withoutUnresolvableLinks
chain option,
+the returned type will not include non-resolvable linked entities
The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+Internal
A single resolved link to another entry in the same space
+If the current client configuration includes withoutLinkResolution
chain option,
+the returned type will not resolve linked entities, but keep them as objects
+If the current client configuration includes withoutUnresolvableLinks
chain option,
+the returned type will not include non-resolvable linked entities
The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+If provided for a client using allLocales
modifier, response type defines locale keys for entry field values.
Shape of the linked entry used to calculate dynamic keys
+Internal
A single resolved reference link to another entry in a different space
+If the current client configuration includes withoutLinkResolution
chain option,
+the returned type will not resolve linked entities, but keep them as objects
+If the current client configuration includes withoutUnresolvableLinks
chain option,
+the returned type will not include non-resolvable linked entities
The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+If provided for a client using allLocales
modifier, response type defines locale keys for entry field values.
Shape of the linked entry used to calculate dynamic keys
+A collection or single resolved link to another resource
+Shape of an entry used to calculate dynamic keys
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+If provided for a client using allLocales
modifier, response type defines locale keys for entry field values.
Internal
A single resolved link to another resource
+Shape of an entry used to calculate dynamic keys
+The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
+If provided for a client using allLocales
modifier, response type defines locale keys for entry field values.
Internal
Subset filters for inclusion & exclusion in provided fields
+All queries applicable to sys fields
+Properties for a single content tag definition
+Search parameters for a tag methods
+Taxonomy Concept link type
+
Create a client instance
+