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

ResourceArray
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.

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

Returns a ResourceArray object containing DeliveryApiKey objects.

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

Returns an Asset resource.

ResourceArray
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.

ResourceArray
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.

ResourceArray
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.

ResourceArray
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.

ResourceArray
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.

ResourceArray
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.

ResourceArray
getExtensions(string $spaceId, string $environmentId)

Returns a ResourceArray object containing Extension resources.

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

Returns a Locale resource.

ResourceArray
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.

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

Returns a ResourceArray object which contains Environment resources.

getPreviewApiKey(string $spaceId, string $previewApiKeyId)

Returns a PreviewApiKey resource.

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

Returns a ResourceArray object containing PreviewApiKey resources.

getRole(string $spaceId, string $roleId)

Returns a Role resource.

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

Returns a ResourceArray object containing Role resources.

getSpaceMembership(string $spaceId, string $spaceMembershipId)

Returns a SpaceMembership resource.

ResourceArray
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.

ResourceArray
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.

ResourceArray
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.

ResourceArray
getSpaces(Query $query = \null)

Returns a ResourceArray object containing Space objects.

getPersonalAccessToken(string $personalAccessTokenId)

Returns a PersonalAccessToken resource.

ResourceArray
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 37
ResourceArray getOrganizations(Query $query = \null)

Returns a ResourceArray object containing Organization resources.

Parameters

Query $query

Return Value

ResourceArray

See also

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

at line 207
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

DeliveryApiKey getDeliveryApiKey(string $spaceId, string $deliveryApiKeyId)

Returns a DeliveryApiKey resource.

Parameters

string $spaceId
string $deliveryApiKeyId

Return Value

DeliveryApiKey

See also

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

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

Returns a ResourceArray object containing DeliveryApiKey objects.

Parameters

string $spaceId
Query $query

Return Value

ResourceArray

See also

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

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

Returns an Asset resource.

Parameters

string $spaceId
string $environmentId
string $assetId

Return Value

Asset

See also

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

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

Returns a ResourceArray object which contains Asset resources.

Parameters

string $spaceId
string $environmentId
Query $query

Return Value

ResourceArray

See also

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

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

Returns a ContentTypeSnapshot resource.

Parameters

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

Return Value

ContentTypeSnapshot

See also

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

ResourceArray 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

Return Value

ResourceArray

See also

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

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

Returns an EditorInterface resource.

Parameters

string $spaceId
string $environmentId
string $contentTypeId

Return Value

EditorInterface

See also

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

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

Returns a ContentType resource.

Parameters

string $spaceId
string $environmentId
string $contentTypeId

Return Value

ContentType

See also

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

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

Returns a ResourceArray object which contains ContentType resources.

Parameters

string $spaceId
string $environmentId
Query $query

Return Value

ResourceArray

See also

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

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

Returns a published ContentType resource.

Parameters

string $spaceId
string $environmentId
string $contentTypeId

Return Value

ContentType

See also

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

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

Returns a ResourceArray object which contains published ContentType resources.

Parameters

string $spaceId
string $environmentId
Query $query

Return Value

ResourceArray

See also

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

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

Returns an EntrySnapshot resource.

Parameters

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

Return Value

EntrySnapshot

See also

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

ResourceArray 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

Return Value

ResourceArray

See also

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

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

Returns an Entry resource.

Parameters

string $spaceId
string $environmentId
string $entryId

Return Value

Entry

See also

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

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

Returns a ResourceArray object which contains Entry resources.

Parameters

string $spaceId
string $environmentId
Query $query

Return Value

ResourceArray

See also

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

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

Returns an Extension resource.

Parameters

string $spaceId
string $environmentId
string $extensionId

Return Value

Extension

See also

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

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

Returns a ResourceArray object containing Extension resources.

Parameters

string $spaceId
string $environmentId

Return Value

ResourceArray

See also

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

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

Returns a Locale resource.

Parameters

string $spaceId
string $environmentId
string $localeId

Return Value

Locale

See also

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

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

Returns a ResourceArray object containing Locale resources.

Parameters

string $spaceId
string $environmentId

Return Value

ResourceArray

See also

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

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

Returns a proxy to an environment resource.

Useful for all environment-scoped operations.

Parameters

string $spaceId
string $environmentId

Return Value

EnvironmentProxy

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

Returns an Environment resource.

Parameters

string $spaceId
string $environmentId

Return Value

Environment

See also

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

in EnvironmentExtension at line 77
ResourceArray getEnvironments(string $spaceId, Query $query = \null)

Returns a ResourceArray object which contains Environment resources.

Parameters

string $spaceId
Query $query

Return Value

ResourceArray

See also

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

PreviewApiKey getPreviewApiKey(string $spaceId, string $previewApiKeyId)

Returns a PreviewApiKey resource.

Parameters

string $spaceId
string $previewApiKeyId

Return Value

PreviewApiKey

See also

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

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

Returns a ResourceArray object containing PreviewApiKey resources.

Parameters

string $spaceId
Query $query

Return Value

ResourceArray

See also

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

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

Returns a Role resource.

Parameters

string $spaceId
string $roleId

Return Value

Role

See also

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

in RoleExtension at line 56
ResourceArray getRoles(string $spaceId, Query $query = \null)

Returns a ResourceArray object containing Role resources.

Parameters

string $spaceId
Query $query

Return Value

ResourceArray

See also

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

SpaceMembership getSpaceMembership(string $spaceId, string $spaceMembershipId)

Returns a SpaceMembership resource.

Parameters

string $spaceId
string $spaceMembershipId

Return Value

SpaceMembership

See also

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

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

Returns a ResourceArray object containing SpaceMembership resources.

Parameters

string $spaceId
Query $query

Return Value

ResourceArray

See also

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

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

Returns an Upload resource.

Parameters

string $spaceId
string $uploadId

Return Value

Upload

See also

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

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

Returns a WebhookCall resource.

Parameters

string $spaceId
string $webhookId
string $webhookCallId

Return Value

WebhookCall

See also

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

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

Returns a ResourceArray object containing WebhookCall resources.

Parameters

string $spaceId
string $webhookId
Query $query

Return Value

ResourceArray

See also

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

WebhookHealth getWebhookHealth(string $spaceId, string $webhookId)

Returns an WebhookHealth resource.

Parameters

string $spaceId
string $webhookId

Return Value

WebhookHealth

See also

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

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

Returns a Webhook resource.

Parameters

string $spaceId
string $webhookId

Return Value

Webhook

See also

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

in WebhookExtension at line 59
ResourceArray getWebhooks(string $spaceId, Query $query = \null)

Returns a ResourceArray object containing Webhook resources.

Parameters

string $spaceId
Query $query

Return Value

ResourceArray

See also

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

in SpaceExtension at line 45
SpaceProxy getSpaceProxy(string $spaceId)

Returns a proxy to a space resource.

Useful for all space-scoped operations.

Parameters

string $spaceId

Return Value

SpaceProxy

in SpaceExtension at line 59
Space getSpace(string $spaceId)

Returns a Space resource.

Parameters

string $spaceId

Return Value

Space

See also

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

in SpaceExtension at line 75
ResourceArray getSpaces(Query $query = \null)

Returns a ResourceArray object containing Space objects.

Parameters

Query $query

Return Value

ResourceArray

See also

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

PersonalAccessToken getPersonalAccessToken(string $personalAccessTokenId)

Returns a PersonalAccessToken resource.

Parameters

string $personalAccessTokenId

Return Value

PersonalAccessToken

See also

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

ResourceArray getPersonalAccessTokens(Query $query = \null)

Returns a ResourceArray object containing PersonalAccessToken resources.

Parameters

Query $query

Return Value

ResourceArray

See also

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

in UserExtension at line 37
User getUserMe()

Returns a User resource.

Return Value

User

See also

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

at line 80
__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 100
ResourceBuilder getBuilder()

Returns the active ResourceBuilder instance.

Return Value

ResourceBuilder

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

{@inheritdoc}

Parameters

string $method
string $uri
array $options

at line 152
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 180
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

Return Value

ResourceInterface

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

Resolves a collection of links to a Contentful resources.

Parameters

array $links
array $parameters

Return Value

ResourceInterface[]

at line 258
getApi()

{@inheritdoc}

at line 266
protected getExceptionNamespace()

{@inheritdoc}

at line 274
static protected getSdkName()

{@inheritdoc}

at line 282
static protected getPackageName()

{@inheritdoc}

at line 290
static protected getApiContentType()

{@inheritdoc}