This is a global notification. You can write markdown here! Link to official website

ApiEndpointsForResource Component

/{projectKey}/resource

post
https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource

Create or Update (POST) operation to a resource.

OAuth 2.0 Scopes:
manage_test:{projectKey}
Path parameters:
region
String

Free text description of the uri parameter.

cloudProvider
String

Free text description of the uri parameter.

projectKey
String

The CTP project key.

Request Body:ObjectTestTypeDraftasapplication/json
Response:
Request Example:cURL
curl https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"objectTypeProperty" : {
"arrayOfIntExample" : [ 1, 2, 1, 3, 2, 3, 1 ],
"arrayOfUniqueIntExample" : [ 1, 3, 5, 7 ],
"arrayOfTwonumbersExample" : [ 3, 5 ],
"arrayOfFloatExample" : [ 0.82 ],
"arrayOfNumberNoDefaultsExample" : [ 10, 9, 8, 7, 6 ],
"arrayOfStringExample" : [ "dog", "cat", "bird" ],
"arrayOfObjectType" : [ {
"integerExample" : 777,
"integerExampleInt32" : 1
}, {
"integerExample" : 30000,
"integerExampleInt32" : 22
} ]
}
}
DATA
201 Response Example: ObjectTestTypejson
{
"version" : 1,
"objectTypeProperty" : {
"arrayOfIntExample" : [ 2, 4, 2, 6, 4, 6, 2 ],
"arrayOfUniqueIntExample" : [ 2, 6, 10, 14 ],
"arrayOfTwonumbersExample" : [ 6, 10 ],
"arrayOfFloatExample" : [ 1.64 ],
"arrayOfNumberNoDefaultsExample" : [ 20, 18, 16, 14, 12 ],
"arrayOfStringExample" : [ "dogdog", "catcat", "birdbird" ],
"arrayOfObjectType" : [ {
"integerExample" : 1554,
"integerExampleInt32" : 2
}, {
"integerExample" : 60000,
"integerExampleInt32" : 22
} ]
}
}
put
https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource

Create or Overwrite (PUT) operation to a resource.

OAuth 2.0 Scopes:
manage_test:{projectKey}
Path parameters:
region
String

Free text description of the uri parameter.

cloudProvider
String

Free text description of the uri parameter.

projectKey
String

The CTP project key.

Request Body:ObjectTestTypeDraftasapplication/json
Response:
201 Response Example: ObjectTestTypejson
{
"version" : 1,
"objectTypeProperty" : {
"arrayOfIntExample" : [ 2, 4, 2, 6, 4, 6, 2 ],
"arrayOfUniqueIntExample" : [ 2, 6, 10, 14 ],
"arrayOfTwonumbersExample" : [ 6, 10 ],
"arrayOfFloatExample" : [ 1.64 ],
"arrayOfNumberNoDefaultsExample" : [ 20, 18, 16, 14, 12 ],
"arrayOfStringExample" : [ "dogdog", "catcat", "birdbird" ],
"arrayOfObjectType" : [ {
"integerExample" : 1554,
"integerExampleInt32" : 2
}, {
"integerExample" : 60000,
"integerExampleInt32" : 22
} ]
}
}
get
https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource

Query/retrieve (GET) a specific resource or resource(s). This should return a paged query result of blah.

OAuth 2.0 Scopes:
manage_test:{projectKey}, view_test:{projectKey}
Path parameters:
region
String

Free text description of the uri parameter.

cloudProvider
String

Free text description of the uri parameter.

projectKey
String

The CTP project key.

Query parameters:
stringParameter
String
floatParameter
Float
integerParameter
Int
withMarkdownDescription
Float

This markdown should be parsed correctly.

objectParameter
arrayOfString
String
The parameter can be passed multiple times.
arrayOfStringWithDescription
String

This should render above the text "The parameter can be passed multiple times."

The parameter can be passed multiple times.
unionParameter
Can be Float, DateTime, or ObjectTestType
Response:
Request Example:cURL
curl --get https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
200 Response Example: ArrayTestTypejson
{
"arrayOfIntExample" : [ 2, 4, 2, 6, 4, 6, 2 ],
"arrayOfUniqueIntExample" : [ 2, 6, 10, 14 ],
"arrayOfTwonumbersExample" : [ 6, 10 ],
"arrayOfFloatExample" : [ 1.64 ],
"arrayOfNumberNoDefaultsExample" : [ 20, 18, 16, 14, 12 ],
"arrayOfStringExample" : [ "dogdog", "catcat", "birdbird" ],
"arrayOfObjectType" : [ {
"integerExample" : 1554,
"integerExampleInt32" : 2
}, {
"integerExample" : 60000,
"integerExampleInt32" : 22
} ]
}

/{projectKey}/resource/images

post
https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource/images

Uploads a binary image file to a given product variant. The supported image formats are JPEG, PNG and GIF.

OAuth 2.0 Scopes:
manage_products:{projectKey}
Request headers:
Content-Type
String
Path parameters:
region
String

Free text description of the uri parameter.

cloudProvider
String

Free text description of the uri parameter.

projectKey
String

The CTP project key.

Query parameters:
filename
String
variant
Int
sku
String
staged
Boolean
Request Body:
image/jpeg
orimage/png
orimage/gif

.

The file to upload

/{projectKey}/resource/namespace-action

post
https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource/namespace-action

Use the POST method to write data to a backend system.

Path parameters:
region
String

Free text description of the uri parameter.

cloudProvider
String

Free text description of the uri parameter.

projectKey
String

The CTP project key.

Response:
200

We recommend to use standard HTTP response codes and application/json encoded content.

get
https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource/namespace-action

Use the GET method to allow the frontend to fetch data asynchronously.

Path parameters:
region
String

Free text description of the uri parameter.

cloudProvider
String

Free text description of the uri parameter.

projectKey
String

The CTP project key.

Response:
200

We recommend to use standard HTTP response codes and application/json encoded content.

Request Example:cURL
curl --get https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource/namespace-action -i

/{projectKey}/resource/namespace-action-with-example

get
https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource/namespace-action-with-example

Use the GET method to allow the frontend to fetch data asynchronously. The example fetches a cart.

Path parameters:
region
String

Free text description of the uri parameter.

cloudProvider
String

Free text description of the uri parameter.

projectKey
String

The CTP project key.

Response:
200

We recommend to use standard HTTP response codes and application/json encoded content. The response will look like the response you have declared in your action. As an example we will fetch the cart.

Request Example:cURL
curl --get https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource/namespace-action-with-example -i
200 Response Example: objectjson
{
"cartId" : "534a5f86-ea14-4b54-b2da-62a0672707e1",
"cartVersion" : "15",
"lineItems" : [ {
"lineItemId" : "d41690bc-ea20-4254-b10b-8dxeac87c1b0",
"productId" : "6bgggaf4-c2b8-4ba7-945e-95e2a113a41f",
"name" : "Casual jacket",
"type" : "variant",
"count" : 1,
"price" : {
"fractionDigits" : 2,
"centAmount" : 39900,
"currencyCode" : "EUR"
},
"discountTexts" : [ ],
"discounts" : [ ],
"totalPrice" : {
"fractionDigits" : 2,
"centAmount" : 39900,
"currencyCode" : "EUR"
},
"variant" : {
"id" : "1",
"sku" : "M0E200KJ1200DSDJ",
"images" : [ "https://your-storage.com/images/casual_jacket.jpg" ],
"groupId" : "78d95",
"attributes" : {
"articleNumberManufacturer" : "621840423 V0065",
"articleNumberMax" : "78665",
"matrixId" : "M0E200KJ1200DSDJ",
"baseId" : "78665",
"designer" : {
"key" : "casual",
"label" : "casual"
},
"madeInItaly" : {
"key" : "no",
"label" : "no"
},
"commonSize" : {
"key" : "xxs",
"label" : "XXS"
},
"size" : "XXS",
"color" : {
"key" : "black",
"label" : "Black"
},
"colorFreeDefinition" : "black",
"style" : {
"key" : "sporty",
"label" : "sporty"
},
"gender" : {
"key" : "men",
"label" : "Men"
},
"season" : "S15"
},
"price" : {
"fractionDigits" : 2,
"centAmount" : 39900,
"currencyCode" : "EUR"
},
"isOnStock" : true
},
"isGift" : false,
"_url" : "/slug/p/M0E200KJ1200DSDJ"
} ],
"sum" : {
"fractionDigits" : 2,
"centAmount" : 39900,
"currencyCode" : "EUR"
},
"shippingAddress" : { },
"billingAddress" : { },
"payments" : [ ],
"discountCodes" : [ ]
}

/{projectKey}/resource/namespace-action-with-headers

get
https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource/namespace-action-with-headers

Use the GET method to allow the frontend to fetch data from a backend system. For the response, we recommend to use standard HTTP codes and application/json encoded content. The response will be structured as defined by the body property of the action.

Request headers:
Frontastic-Locale
String

Locale

Frontastic-Path
String

Path

Pattern: ^/.*$
Accept
String

Accept application/json Header

Pattern: application/json
Path parameters:
region
String

Free text description of the uri parameter.

cloudProvider
String

Free text description of the uri parameter.

projectKey
String

The CTP project key.

Response:
200

The response will be structured as defined by the body property of the action.

Request Example:cURL
curl --get https://api.{region}.{cloudProvider}.commercetools.com/{projectKey}/resource/namespace-action-with-headers -i \
--header 'Frontastic-Locale: ${FRONTASTIC_LOCALE}'\
--header 'Frontastic-Path: ${FRONTASTIC_PATH}'\
--header 'Accept: ${ACCEPT}'
200 Response Example: objectjson
{
"cartId" : "534a5f86-ea14-4b54-b2da-62a0672707e1",
"cartVersion" : "15",
"lineItems" : [ {
"lineItemId" : "d41690bc-ea20-4254-b10b-8dxeac87c1b0",
"productId" : "6bgggaf4-c2b8-4ba7-945e-95e2a113a41f",
"name" : "Casual jacket",
"type" : "variant",
"count" : 1,
"price" : {
"fractionDigits" : 2,
"centAmount" : 39900,
"currencyCode" : "EUR"
},
"discountTexts" : [ ],
"discounts" : [ ],
"totalPrice" : {
"fractionDigits" : 2,
"centAmount" : 39900,
"currencyCode" : "EUR"
},
"variant" : {
"id" : "1",
"sku" : "M0E200KJ1200DSDJ",
"images" : [ "https://your-storage.com/images/casual_jacket.jpg" ],
"groupId" : "78d95",
"attributes" : {
"articleNumberManufacturer" : "621840423 V0065",
"articleNumberMax" : "78665",
"matrixId" : "M0E200KJ1200DSDJ",
"baseId" : "78665",
"designer" : {
"key" : "casual",
"label" : "casual"
},
"madeInItaly" : {
"key" : "no",
"label" : "no"
},
"commonSize" : {
"key" : "xxs",
"label" : "XXS"
},
"size" : "XXS",
"color" : {
"key" : "black",
"label" : "Black"
},
"colorFreeDefinition" : "black",
"style" : {
"key" : "sporty",
"label" : "sporty"
},
"gender" : {
"key" : "men",
"label" : "Men"
},
"season" : "S15"
},
"price" : {
"fractionDigits" : 2,
"centAmount" : 39900,
"currencyCode" : "EUR"
},
"isOnStock" : true
},
"isGift" : false,
"_url" : "/slug/p/M0E200KJ1200DSDJ"
} ],
"sum" : {
"fractionDigits" : 2,
"centAmount" : 39900,
"currencyCode" : "EUR"
},
"shippingAddress" : { },
"billingAddress" : { },
"payments" : [ ],
"discountCodes" : [ ]
}