Contentful Delivery API SDK. Allows you to create instances of a client
with access to the Contentful Content Delivery API.
- See:
Methods
(static) createClient(params) → {ContentfulClientAPI.ClientAPI} #
Create a client instance
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Client initialization parameters |
Returns:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
params.space |
string | Space ID | |
params.accessToken |
string | Contentful CDA Access Token | |
params.insecure |
boolean |
<optional> |
Requests will be made over http instead of the default https (default: true) |
params.host |
string |
<optional> |
API host (default: cdn.contentful.com). Also usable with preview.contentful.com. |
params.agent |
Object |
<optional> |
Optional Node.js HTTP agent for proxying (see Node.js docs and https-proxy-agent) |
params.headers |
Object |
<optional> |
Optional additional headers |
params.concurrency |
number |
<optional> |
Number of allowed concurrent requests. Changing this value is not recommended. (default: 6) |
params.delay |
number |
<optional> |
Delay in milliseconds for waiting after hitting the allowed number of concurrent requests. Changing this value is not recommended. (default: 1000) |
params.maxRetries |
number |
<optional> |
Maximum number of retries when a 429 is received (default: 5) |
params.retryOnTooManyRequests |
boolean |
<optional> |
If we should retry on 429s (default: true) |
- Source:
Example
const client = contentful.createClient({
accessToken: 'myAccessToken',
space: 'mySpaceId'
})