BETA

Importing Prices

This page documents the API under the price endpoint /{projectKey}/prices. Namely, we document PriceImportRequest and the endpoint methods for ImportOperations for Prices.

PriceImportRequest

Representations

PriceImportRequest

An import request for multiple price import resources.

type
String
"price"

The price import resource type.

resources
Array of PriceImport

The price import resources of this request.

MaxItems: 20
Example: json
{
"type" : "price",
"resources" : [ {
"key" : "bigPriceKeyTestCat",
"productVariant" : {
"typeId" : "product-variant",
"key" : "red-t-shirt"
},
"product" : {
"typeId" : "product",
"key" : "t-shirt"
},
"value" : {
"type" : "centPrecision",
"currencyCode" : "EUR",
"centAmount" : 300
}
} ]
}

PriceImport

Imports a product variant's prices.

key
String

Maps to Price.value.

The Import API only supports centPrecision prices.

country
CountryCode

Maps to Price.county.

Pattern: ^[A-Z]{2}$
validFrom
DateTime

Maps to Price.validFrom.

validUntil
DateTime

Maps to Price.validUntil.

References a customer group by its key.

The customer group referenced must already exist in the commercetools project, or the import operation state is set to Unresolved.

References a channel by its key.

The channel referenced must already exist in the commercetools project, or the import operation state is set to Unresolved.

discounted
DiscountedPrice

Sets a discounted price from an external service.

publish
Boolean

Only the Price updates will be published to staged and current projection.

Default: false
tiers
Array of PriceTier

The tiered prices for this price.

The product variant in which this price is contained.

The product variant referenced must already exist in the commercetools project, or the import operation state is set to Unresolved.

The product in which this product variant containong the price is contained. Maps to ProductVariant.product.

The product referenced must already exist in the commercetools project, or the import operation state is set to Unresolved.

custom

The custom fields for this price.

Endpoints

Request New Price Data to be Imported

Creates import request for creating new prices or updating existing ones.

POST
https://import.europe-west1.gcp.commercetools.com/{projectKey}/prices/importSinkKey={importSinkKey}
OAuth 2.0 Scopes:
manage_project:{projectKey}, manage_products:{projectKey}
Path Parameters:
projectKey
String
The commercetools project key.
importSinkKey
String
The import sink used to create the new resource
Request Body:PriceImportRequest
Response:

201ImportResponse

Request Prices to be Deleted

Deletes the price given by the resource key.

DELETE
https://import.europe-west1.gcp.commercetools.com/{projectKey}/prices/importSinkKey={importSinkKey}/resourceKey={resourceKey}
Path Parameters:
projectKey
String
The commercetools project key.
importSinkKey
String
The import sink used to create the new resource
resourceKey
String
-
Response:

200ImportOperationStatus

Request Example:cURL
curl -X DELETE https://import.europe-west1.gcp.commercetools.com/{projectKey}/prices/importSinkKey={importSinkKey}/resourceKey={resourceKey} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'

Get ImportOperations

Get ImportOperations by an ImportSink Key

Retrieves all price import operations of an import sink key.

GET
https://import.europe-west1.gcp.commercetools.com/{projectKey}/prices/importSinkKey={importSinkKey}/import-operations
OAuth 2.0 Scopes:
manage_project:{projectKey}, manage_products:{projectKey}, view_products:{projectKey}
Path Parameters:
projectKey
String
The commercetools project key.
importSinkKey
String
The import sink used to create the new resource
Query Parameters:
limit
Float
-
offset
Float
-
resourceKey
String
The key of the import operation to retrieve.
state
The state of the import operations to retrieve.
Request Example:cURL
curl -X GET https://import.europe-west1.gcp.commercetools.com/{projectKey}/prices/importSinkKey={importSinkKey}/import-operations -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'

Get an ImportOperation by its ID

Retrieves the import operation with the given id.

GET
https://import.europe-west1.gcp.commercetools.com/{projectKey}/prices/importSinkKey={importSinkKey}/import-operations/{id}
OAuth 2.0 Scopes:
manage_project:{projectKey}, manage_products:{projectKey}, view_products:{projectKey}
Path Parameters:
projectKey
String
The commercetools project key.
importSinkKey
String
The import sink used to create the new resource
id
String
The operation identifier
Response:
Request Example:cURL
curl -X GET https://import.europe-west1.gcp.commercetools.com/{projectKey}/prices/importSinkKey={importSinkKey}/import-operations/{id} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Response Example:json
{
"version" : 1,
"state" : "Unresolved",
"importSinkKey" : "category-import-sink",
"resourceKey" : "child-category",
"resourceType" : "category",
"resourceAsString" : "'{}'",
"id" : "252c6ed3-c668-4610-afe9-87b9255e62e0",
"createdAt" : "2018-02-05T09:47:16.648Z",
"lastModifiedAt" : "2018-02-05T09:47:16.649Z",
"expiresAt" : "2018-02-08T09:47:16.649Z",
"retryCount" : 0,
"unresolvedReferences" : [ {
"typeId" : "category",
"key" : "my-parent-category-key"
} ]
}