Queries and mutations for managing API Extensions in the platform.

Queries

Query API Extensions

QUERYextensions
Arguments
where​
String​
sort​
Array of String​
limit​
Int​
offset​
Int​

Get API Extension

QUERYextension
Arguments
id​
String​

Queries with specified ID

key​
String​

Queries with specified key

Output:Extension

Mutations

Create API Extension

MUTATIONcreateExtension
Arguments
draft​
Output:Extension

Update API Extension

MUTATIONupdateExtension
Arguments
version​
Long​
actions​
id​
String​

Queries with specified ID

key​
String​

Queries with specified key

Output:Extension

Delete API Extension

MUTATIONdeleteExtension
Arguments
version​
Long​
id​
String​

Queries with specified ID

key​
String​

Queries with specified key

Output:Extension

Output types

Extension

The REST dependencies field is available only as dependenciesRef, which returns a list of References. To set dependencies, use dependencies in ExtensionDraft or the Set Dependencies update action. Both take ResourceIdentifiers.
key​
String​

User-defined unique identifier of the Extension.

destination​

The configuration for the Extension, including its type, location and authentication details.

triggers​
Array of Trigger​

Describes what triggers the Extension.

timeoutInMs​
Int​
Maximum time (in milliseconds) that the Extension can respond within. If no timeout is provided, the default value is used for all types of Extensions.
The limit of 10000 ms (10 seconds) can be increased per Project after we review the performance impact. Please contact the commercetools support team and provide the Region, Project key, and use case.
dependenciesRef​
Array of Reference​

References to other Extensions that must complete before this Extension is called. The Extension receives the resource state after all transitive ancestors' update actions have been applied. Maximum 5 entries.

additionalContext​

Configures additional information included in the payload sent to the API Extension.

expansionPaths​
Array of String​
Expansion paths used for reference expansion of the payload.
Be aware of the limits of this feature and its performance impact.
id​
String​

Unique identifier of the Extension.

version​
Long​

Current version of the Extension.

createdAt​

Date and time (UTC) the Extension was initially created.

lastModifiedAt​

Date and time (UTC) the Extension was last updated.

createdBy​

IDs and references that created the Extension.

lastModifiedBy​

IDs and references that last modified the Extension.

ExtensionQueryResult

offset​
Int​
count​
Int​
total​
Long​
exists​
Boolean​
results​
Array of Extension​

Trigger

This type is equivalent to ExtensionTrigger in REST. In GraphQL, resourceTypeId is a String, not an enum. It accepts the values listed in ExtensionResourceTypeId.
resourceTypeId​
String​
actions​
Array of ActionType​
Can be Create, or Update​
condition​
String​

ActionType

Create
Update

ExtensionAdditionalContext

Configures additional information included in the payload sent to the API Extension.

includeOldResource​
Boolean​
Whether the payload sent to the API Extension should include an oldResource field with the state of the resource before the update. This only applies to Update actions. For Create actions, oldResource is not included.

ExtensionDestination

type​
String​

AWSLambdaDestination

We recommend creating an Identify and Access Management (IAM) user with an accessKey and accessSecret pair, specifically for each Extension that only has the lambda:InvokeFunction permission on this function.
arn​
String​
Amazon Resource Name (ARN) of the Lambda function in the format arn:aws:lambda:<region>:<accountid>:function:<functionName>. Use the format arn:aws:lambda:<region>:<accountid>:function:<functionName>:<functionAlias/version> to point to a specific version of the function.
accessKey​
String​

Partially hidden on retrieval for security reasons.

accessSecret​
String​

Partially hidden on retrieval for security reasons.

type​
String​

GoogleCloudFunctionDestination

For GoogleCloudFunction destinations, you need to grant permissions to the extensions@commercetools-platform.iam.gserviceaccount.com service account to invoke your function. If your function's version is 1st gen, grant the service account the IAM role Cloud Functions Invoker. For version 2nd gen, assign the IAM role Cloud Run Invoker using the Cloud Run console.
url​
String​

URL to the target function.

type​
String​

HttpDestination

We recommend an encrypted HTTPS connection for production setups. However, we also accept unencrypted HTTP connections for development purposes. HTTP redirects will not be followed and cache headers will be ignored.
type​
String​
url​
String​

URL to the target destination.

authentication​
Authentication methods (such as Basic or Bearer).

HttpDestinationAuthentication

type​
String​

AuthorizationHeader

headerValue​
String​
type​
String​

AzureFunctionsAuthentication

To protect your Azure Function, set its authLevel to function and provide the function's key to be used inside the x-functions-key header. For more information, see the Azure Functions documentation.
To protect the secret key from being exposed, remove the code parameter and secret key from the URL. For example, use https://foo.azurewebsites.net/api/bar instead of https://foo.azurewebsites.net/api/bar?code=secret.
key​
String​

Partially hidden on retrieval for security reasons.

type​
String​

Input types

ExtensionDraft

key​
String​

User-defined unique identifier for the Extension.

destination​

Defines where the Extension can be reached.

triggers​
Array of TriggerInput​

Describes what triggers the Extension.

timeoutInMs​
Int​
Maximum time (in milliseconds) the Extension can respond within. If no timeout is provided, the default value is used for all types of Extensions. We recommend keeping the timeout as low as possible to avoid performance issues.
The limit of 10000 ms (10 seconds) can be increased per Project after we review the performance impact. Please contact the commercetools support team and provide the Region, Project key, and use case.
dependencies​
Extensions that must complete before this Extension is called, identified by id or key. Maximum 5 entries. If omitted, the Extension has no dependencies and may run concurrently with other independent Extensions.
additionalContext​

Configures additional information included in the payload sent to the API Extension.

expansionPaths​
Array of String​
Expansion paths used for reference expansion of the payload.
Be aware of the limits of this feature and its performance impact.

TriggerInput

resourceTypeId​
String​
actions​
Array of ActionType​
Can be Create, or Update​
condition​
String​

ExtensionDestinationInput

REST identifies the destination with a type field. In GraphQL, the input has one field per destination type instead: HTTP, AWSLambda, and GoogleCloudFunction. These names match the type values of ExtensionDestination in REST. The same applies to HttpDestinationAuthenticationInput, which has the fields AuthorizationHeader and AzureFunctions.
HTTP​
AWSLambda​
GoogleCloudFunction​

AWSLambdaDestinationInput

arn​
String​
accessKey​
String​
accessSecret​
String​

HttpDestinationInput

url​
String​
authentication​

GoogleCloudFunctionDestinationInput

url​
String​

AzureFunctionsAuthenticationInput

key​
String​

HttpDestinationAuthenticationInput

AuthorizationHeader​
AzureFunctions​

AuthorizationHeaderInput

headerValue​
String​

ExtensionAdditionalContextInput

includeOldResource​
Boolean​

ExtensionUpdateAction

changeDestination​
changeTriggers​
setAdditionalContext​
setExpansionPaths​
setDependencies​
setKey​
setTimeoutInMs​

Update actions

Change Destination

destination​

New value to set. Must not be empty.

Change Triggers

triggers​
Array of TriggerInput​

New value to set. Must not be empty.

Set Additional Context

additionalContext​

New value to set.

Set Expansion Paths

expansionPaths​
Array of String​
Expansion paths used for reference expansion of the payload.
Be aware of the limits of this feature and its performance impact.

Set Dependencies

dependencies​
Extensions this Extension depends on, identified by id or key. Set to an empty array to remove all dependencies. Maximum 5 entries.

Set Key

key​
String​

Value to set. If omitted, any existing value is removed.

Set TimeoutInMs

timeoutInMs​
Int​
Value to set. If no timeout is provided, the default value is used for all types of Extensions. We recommend keeping the timeout as low as possible to avoid performance issues.
The limit of 10000 ms (10 seconds) can be increased per Project after we review the performance impact. Please contact the commercetools support team and provide the Region, Project key, and use case.