class Client extends BaseClient

Client class.

This class is responsible for querying Contentful's Content Management API.

Traits

OrganizationExtension trait.
SpaceExtension trait.
UserExtension trait.
DeliveryApiKeyExtension trait.
EnvironmentExtension trait.
PreviewApiKeyExtension trait.
RoleExtension trait.
SpaceMembershipExtension trait.
UploadExtension trait.
WebhookExtension trait.
AssetExtension trait.
ContentTypeExtension trait.
EntryExtension trait.
ExtensionExtension trait.
LocaleExtension trait.
ContentTypeSnapshotExtension trait.
EditorInterfaceExtension trait.
EntrySnapshotExtension trait.
WebhookCallExtension trait.
WebhookHealthExtension trait.
PersonalAccessTokenExtension trait.

Constants

URI_MANAGEMENT

The default URI to which all requests should be made.

URI_UPLOAD

The special URI for uploading files.

Methods

getOrganizations(Query $query = null)

Returns a ResourceArray object containing Organization resources.

ResourceInterface|ResourceArray
fetchResource(string $class, array $parameters, Query $query = null, ResourceInterface $resource = null)

No description

getDeliveryApiKey(string $spaceId, string $deliveryApiKeyId)

Returns a DeliveryApiKey resource.

getDeliveryApiKeys(string $spaceId, Query $query = null)

Returns a ResourceArray object containing DeliveryApiKey objects.

getAsset(string $spaceId, string $environmentId, string $assetId)

Returns an Asset resource.

getAssets(string $spaceId, string $environmentId, Query $query = null)

Returns a ResourceArray object which contains Asset resources.

getContentTypeSnapshot(string $spaceId, string $environmentId, string $contentTypeId, string $snapshotId)

Returns a ContentTypeSnapshot resource.

getContentTypeSnapshots(string $spaceId, string $environmentId, string $contentTypeId, Query $query = null)

Returns a ResourceArray object which contains ContentTypeSnapshot resources.

getEditorInterface(string $spaceId, string $environmentId, string $contentTypeId)

Returns an EditorInterface resource.

getContentType(string $spaceId, string $environmentId, string $contentTypeId)

Returns a ContentType resource.

getContentTypes(string $spaceId, string $environmentId, Query $query = null)

Returns a ResourceArray object which contains ContentType resources.

getPublishedContentType(string $spaceId, string $environmentId, string $contentTypeId)

Returns a published ContentType resource.

getPublishedContentTypes(string $spaceId, string $environmentId, Query $query = null)

Returns a ResourceArray object which contains published ContentType resources.

getEntrySnapshot(string $spaceId, string $environmentId, string $entryId, string $snapshotId)

Returns an EntrySnapshot resource.

getEntrySnapshots(string $spaceId, string $environmentId, string $entryId, Query $query = null)

Returns a ResourceArray object which contains EntrySnapshot resources.

getEntry(string $spaceId, string $environmentId, string $entryId)

Returns an Entry resource.

getEntries(string $spaceId, string $environmentId, Query $query = null)

Returns a ResourceArray object which contains Entry resources.

getExtension(string $spaceId, string $environmentId, string $extensionId)

Returns an Extension resource.

getExtensions(string $spaceId, string $environmentId)

Returns a ResourceArray object containing Extension resources.

getLocale(string $spaceId, string $environmentId, string $localeId)

Returns a Locale resource.

getLocales(string $spaceId, string $environmentId)

Returns a ResourceArray object containing Locale resources.

getEnvironmentProxy(string $spaceId, string $environmentId = 'master')

Returns a proxy to an environment resource.

getEnvironment(string $spaceId, string $environmentId)

Returns an Environment resource.

getEnvironments(string $spaceId, Query $query = null)

Returns a ResourceArray object which contains Environment resources.

getPreviewApiKey(string $spaceId, string $previewApiKeyId)

Returns a PreviewApiKey resource.

getPreviewApiKeys(string $spaceId, Query $query = null)

Returns a ResourceArray object containing PreviewApiKey resources.

getRole(string $spaceId, string $roleId)

Returns a Role resource.

getRoles(string $spaceId, Query $query = null)

Returns a ResourceArray object containing Role resources.

getSpaceMembership(string $spaceId, string $spaceMembershipId)

Returns a SpaceMembership resource.

getSpaceMemberships(string $spaceId, Query $query = null)

Returns a ResourceArray object containing SpaceMembership resources.

getUpload(string $spaceId, string $uploadId)

Returns an Upload resource.

getWebhookCall(string $spaceId, string $webhookId, string $webhookCallId)

Returns a WebhookCall resource.

getWebhookCalls(string $spaceId, string $webhookId, Query $query = null)

Returns a ResourceArray object containing WebhookCall resources.

getWebhookHealth(string $spaceId, string $webhookId)

Returns an WebhookHealth resource.

getWebhook(string $spaceId, string $webhookId)

Returns a Webhook resource.

getWebhooks(string $spaceId, Query $query = null)

Returns a ResourceArray object containing Webhook resources.

getSpaceProxy(string $spaceId)

Returns a proxy to a space resource.

getSpace(string $spaceId)

Returns a Space resource.

getSpaces(Query $query = null)

Returns a ResourceArray object containing Space objects.

getPersonalAccessToken(string $personalAccessTokenId)

Returns a PersonalAccessToken resource.

getPersonalAccessTokens(Query $query = null)

Returns a ResourceArray object containing PersonalAccessToken resources.

getUserMe()

Returns a User resource.

__construct(string $accessToken, array $options = [])

Client constructor.

getBuilder()

Returns the active ResourceBuilder instance.

request(string $method, string $uri, array $options = [])

{@inheritdoc}

create(CreatableInterface $resource, string $resourceId = '', ResourceInterface|string[] $parameters = [])

Persists the current resource in the given scope.

ResourceInterface|ResourceArray|null
requestWithResource(ResourceInterface $resource, string $method, string $path = '', array $options = [])

Make an API request using the given resource.

resolveLink(Link $link, array $parameters = [])

Resolves a link to a Contentful resource.

resolveLinkCollection(array $links, array $parameters = [])

Resolves a collection of links to a Contentful resources.

getApi()

{@inheritdoc}

getExceptionNamespace()

{@inheritdoc}

static 
getSdkName()

{@inheritdoc}

static 
getPackageName()

{@inheritdoc}

static 
getApiContentType()

{@inheritdoc}

Details

in OrganizationExtension at line 33
getOrganizations(Query $query = null)

Returns a ResourceArray object containing Organization resources.

Parameters

Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/organizations

at line 241
ResourceInterface|ResourceArray fetchResource(string $class, array $parameters, Query $query = null, ResourceInterface $resource = null)

Parameters

string $class
array $parameters
Query $query
ResourceInterface $resource

Return Value

ResourceInterface|ResourceArray

getDeliveryApiKey(string $spaceId, string $deliveryApiKeyId)

Returns a DeliveryApiKey resource.

Parameters

string $spaceId
string $deliveryApiKeyId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/api-keys

getDeliveryApiKeys(string $spaceId, Query $query = null)

Returns a ResourceArray object containing DeliveryApiKey objects.

Parameters

string $spaceId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/api-keys/api-keys-collection

in AssetExtension at line 33
getAsset(string $spaceId, string $environmentId, string $assetId)

Returns an Asset resource.

Parameters

string $spaceId
string $environmentId
string $assetId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets/asset

in AssetExtension at line 47
getAssets(string $spaceId, string $environmentId, Query $query = null)

Returns a ResourceArray object which contains Asset resources.

Parameters

string $spaceId
string $environmentId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets/assets-collection

getContentTypeSnapshot(string $spaceId, string $environmentId, string $contentTypeId, string $snapshotId)

Returns a ContentTypeSnapshot resource.

Parameters

string $spaceId
string $environmentId
string $contentTypeId
string $snapshotId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/content-type-snapshot

getContentTypeSnapshots(string $spaceId, string $environmentId, string $contentTypeId, Query $query = null)

Returns a ResourceArray object which contains ContentTypeSnapshot resources.

Parameters

string $spaceId
string $environmentId
string $contentTypeId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/content-type-snapshots-collection

getEditorInterface(string $spaceId, string $environmentId, string $contentTypeId)

Returns an EditorInterface resource.

Parameters

string $spaceId
string $environmentId
string $contentTypeId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface

in ContentTypeExtension at line 37
getContentType(string $spaceId, string $environmentId, string $contentTypeId)

Returns a ContentType resource.

Parameters

string $spaceId
string $environmentId
string $contentTypeId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types/content-type

in ContentTypeExtension at line 51
getContentTypes(string $spaceId, string $environmentId, Query $query = null)

Returns a ResourceArray object which contains ContentType resources.

Parameters

string $spaceId
string $environmentId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types/content-type-collection

in ContentTypeExtension at line 64
getPublishedContentType(string $spaceId, string $environmentId, string $contentTypeId)

Returns a published ContentType resource.

Parameters

string $spaceId
string $environmentId
string $contentTypeId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types/activated-content-type-collection

in ContentTypeExtension at line 78
getPublishedContentTypes(string $spaceId, string $environmentId, Query $query = null)

Returns a ResourceArray object which contains published ContentType resources.

Parameters

string $spaceId
string $environmentId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types/activated-content-type-collection

getEntrySnapshot(string $spaceId, string $environmentId, string $entryId, string $snapshotId)

Returns an EntrySnapshot resource.

Parameters

string $spaceId
string $environmentId
string $entryId
string $snapshotId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/entry-snapshot

getEntrySnapshots(string $spaceId, string $environmentId, string $entryId, Query $query = null)

Returns a ResourceArray object which contains EntrySnapshot resources.

Parameters

string $spaceId
string $environmentId
string $entryId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/entry-snapshots-collection

in EntryExtension at line 35
getEntry(string $spaceId, string $environmentId, string $entryId)

Returns an Entry resource.

Parameters

string $spaceId
string $environmentId
string $entryId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries/entry

in EntryExtension at line 49
getEntries(string $spaceId, string $environmentId, Query $query = null)

Returns a ResourceArray object which contains Entry resources.

Parameters

string $spaceId
string $environmentId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries/entries-collection

in ExtensionExtension at line 33
getExtension(string $spaceId, string $environmentId, string $extensionId)

Returns an Extension resource.

Parameters

string $spaceId
string $environmentId
string $extensionId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/ui-extensions/extension

in ExtensionExtension at line 47
getExtensions(string $spaceId, string $environmentId)

Returns a ResourceArray object containing Extension resources.

Parameters

string $spaceId
string $environmentId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/ui-extensions/extensions-collection

in LocaleExtension at line 33
getLocale(string $spaceId, string $environmentId, string $localeId)

Returns a Locale resource.

Parameters

string $spaceId
string $environmentId
string $localeId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/locales/locale

in LocaleExtension at line 47
getLocales(string $spaceId, string $environmentId)

Returns a ResourceArray object containing Locale resources.

Parameters

string $spaceId
string $environmentId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/locales/locale-collection

in EnvironmentExtension at line 39
getEnvironmentProxy(string $spaceId, string $environmentId = 'master')

Returns a proxy to an environment resource.

Useful for all environment-scoped operations.

Parameters

string $spaceId
string $environmentId

in EnvironmentExtension at line 49
getEnvironment(string $spaceId, string $environmentId)

Returns an Environment resource.

Parameters

string $spaceId
string $environmentId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/environments/environment

in EnvironmentExtension at line 62
getEnvironments(string $spaceId, Query $query = null)

Returns a ResourceArray object which contains Environment resources.

Parameters

string $spaceId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/environments/environments-collection

getPreviewApiKey(string $spaceId, string $previewApiKeyId)

Returns a PreviewApiKey resource.

Parameters

string $spaceId
string $previewApiKeyId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/api-keys

getPreviewApiKeys(string $spaceId, Query $query = null)

Returns a ResourceArray object containing PreviewApiKey resources.

Parameters

string $spaceId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/api-keys/api-keys-collection

in RoleExtension at line 33
getRole(string $spaceId, string $roleId)

Returns a Role resource.

Parameters

string $spaceId
string $roleId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/roles/role

in RoleExtension at line 46
getRoles(string $spaceId, Query $query = null)

Returns a ResourceArray object containing Role resources.

Parameters

string $spaceId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/roles/roles-collection

getSpaceMembership(string $spaceId, string $spaceMembershipId)

Returns a SpaceMembership resource.

Parameters

string $spaceId
string $spaceMembershipId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/space-memberships/space-membership

getSpaceMemberships(string $spaceId, Query $query = null)

Returns a ResourceArray object containing SpaceMembership resources.

Parameters

string $spaceId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/space-memberships

in UploadExtension at line 33
getUpload(string $spaceId, string $uploadId)

Returns an Upload resource.

Parameters

string $spaceId
string $uploadId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/uploads/retrieving-an-upload

in WebhookCallExtension at line 33
getWebhookCall(string $spaceId, string $webhookId, string $webhookCallId)

Returns a WebhookCall resource.

Parameters

string $spaceId
string $webhookId
string $webhookCallId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-call-details

in WebhookCallExtension at line 47
getWebhookCalls(string $spaceId, string $webhookId, Query $query = null)

Returns a ResourceArray object containing WebhookCall resources.

Parameters

string $spaceId
string $webhookId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-call-overview

getWebhookHealth(string $spaceId, string $webhookId)

Returns an WebhookHealth resource.

Parameters

string $spaceId
string $webhookId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-health

in WebhookExtension at line 36
getWebhook(string $spaceId, string $webhookId)

Returns a Webhook resource.

Parameters

string $spaceId
string $webhookId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhooks/webhook

in WebhookExtension at line 49
getWebhooks(string $spaceId, Query $query = null)

Returns a ResourceArray object containing Webhook resources.

Parameters

string $spaceId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhooks/webhooks-collection

in SpaceExtension at line 41
getSpaceProxy(string $spaceId)

Returns a proxy to a space resource.

Useful for all space-scoped operations.

Parameters

string $spaceId

in SpaceExtension at line 51
getSpace(string $spaceId)

Returns a Space resource.

Parameters

string $spaceId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/spaces/space

in SpaceExtension at line 63
getSpaces(Query $query = null)

Returns a ResourceArray object containing Space objects.

Parameters

Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/spaces/spaces-collection

getPersonalAccessToken(string $personalAccessTokenId)

Returns a PersonalAccessToken resource.

Parameters

string $personalAccessTokenId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/personal-access-tokens/personal-access-token

getPersonalAccessTokens(Query $query = null)

Returns a ResourceArray object containing PersonalAccessToken resources.

Parameters

Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/personal-access-tokens/personal-access-tokens-collection

in UserExtension at line 35
getUserMe()

Returns a User resource.

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/users/user

at line 92
__construct(string $accessToken, array $options = [])

Client constructor.

Parameters

string $accessToken A OAuth token or personal access token generated by Contentful
array $options An array of options, with the following supported values: * guzzle: an instance of the Guzzle client * logger: a PSR-3 logger * host: a string that will replace the default Contentful URI

at line 111
getBuilder()

Returns the active ResourceBuilder instance.

at line 119
request(string $method, string $uri, array $options = [])

{@inheritdoc}

Parameters

string $method
string $uri
array $options

at line 189
create(CreatableInterface $resource, string $resourceId = '', ResourceInterface|string[] $parameters = [])

Persists the current resource in the given scope.

You can use this method in 2 ways.

Creating using an actual resource object

// $environment is an instance of Contentful\Management\Resource\Environment
$client->create($entry, $environment);

Creating using an array with the required IDs

$client->create($entry, $entryCustomId, ['space' => $spaceId, 'environment' => $environmentId]);

Parameters

CreatableInterface $resource The resource that needs to be created in Contentful
string $resourceId If this parameter is specified, the SDK will attempt to create a resource by making a PUT request on the endpoint by also specifying the ID
ResourceInterface|string[] $parameters Either an actual resource object, or an array containing the required IDs

at line 217
ResourceInterface|ResourceArray|null requestWithResource(ResourceInterface $resource, string $method, string $path = '', array $options = [])

Make an API request using the given resource.

The object will be used to infer the API endpoint.

Parameters

ResourceInterface $resource An SDK resource object
string $method The HTTP method
string $path Optionally, a path to be added at the of the URI (like "/published")
array $options An array of valid options (host, body, headers)

Return Value

ResourceInterface|ResourceArray|null

Resolves a link to a Contentful resource.

Parameters

Link $link
array $parameters

at line 276
resolveLinkCollection(array $links, array $parameters = [])

Resolves a collection of links to a Contentful resources.

Parameters

array $links
array $parameters

at line 284
getApi()

{@inheritdoc}

at line 292
protected getExceptionNamespace()

{@inheritdoc}

at line 300
static protected getSdkName()

{@inheritdoc}

at line 308
static protected getPackageName()

{@inheritdoc}

at line 316
static protected getApiContentType()

{@inheritdoc}