Description and Overview
Representation
Identifier | Type | Description | Restrictions |
---|---|---|---|
countryCode | String | Country code [ISO 3166-1] format | [A-Z]{2} |
languageCode | String | Language code [ISO 639-1] format | [a-z]{2} |
currencyUnit | String | Currency unit [ISO 4217] format | [A-Z]{2} |
taxPercentage | Integer | Tax percentage for store | Min: 0. Max: 40 |
Create your stores
curl --request PUT \
--url https://api.${env}.brinkcommerce.com/productv1/stores \
--header 'content-type: application/json' \
--header 'x-api-key: ${product api key}' \
--data '{
"countryCode": "SE",
"languageCode": "sv",
"currencyUnit": "SEK",
"tax": 0
}'
Concept
Brink Commerce support webhooks on Order or Product status changes. If you need multiple hooks create them with different hook names.
Add webhook
To add a webhook you need to provide a name and callback URL for Brink Commerce to use
Identifier | Type | Description | Restrictions |
---|---|---|---|
name | String | Name of the webhook. Required | webhook\.(order|product)\.(\w+) |
data.url | String | Callback URL. Required | URL |
data.headers | Object | Optional headers to send with the callback |
curl --request PUT \
--url https://api.${env}.brinkcommerce.com/configurationv1/configurations/webhooks \
--header 'content-type: application/json' \
--header 'x-api-key: ${api key}' \
--data '[
{
"name": "webhook.${order|product}.newHookName",
"data": {
"url": "https://1527b018dffa8a2320879f1728e72958.m.pipedream.net",
"headers": {
"hello": "world"
}
}
}
]'
Response
[
{
"service": "brink",
"name": "webhook.${order|product}.newHookName",
"data": {
"url": "https://1527b018dffa8a2320879f1728e72958.m.pipedream.net",
"headers": {
"hello": "world"
}
}
}
]
Brink Commerce will POST a sample message to the endpoint provided to verify its validity. If there was a problem for Brink Commerce to POST to the configured URL you will receive a 400 Bad Request
Verification message:
{
"message": "Hello from Brink Commerce"
}
Order callback
Brink Commerce will send a callback for when there is a state change on order.
State values are (success|refunded|canceled|shipped|waiting)
Example of a callback:
{
"service": "order",
"state": "success",
"orderId": "f3a1b916-63b5-469f-8654-2762d5ca8589"
}
Product callback
Brink Commerce will send a callback for when there is a state change on product.
State values are (created|updated)
Example of a callback:
{
"service": "product",
"state": "created",
"productId": "e9fd11fb-ce94-4eee-a253-3c180a94f857"
}
##Description Products exist in Brink for processing orders and transaction purposes only, meaning there are no product information enrichment possibilities in Brink but rather transactional necessary information only such as SKU number, price and stock. Setting up a product is done using the product API. There are three different types of products within Brink
Product
Model Product has 5 different types
- product
- productVariant
- shippingProvider
- shippingOption
- addon
Hooks can be configured for the different statuses of the product
Create product
curl --request POST \
--url https://api.${env}.brinkcommerce.com/productv1/products \
--header 'content-type: application/json' \
--header 'x-api-key: ${product api key}' \
--data '[{
"id": "product-id",
"name": "Black socks",
"type": "product",
"category": "Socks",
}]'
Create product variant related to the product
curl --request POST \
--url https://api.${env}.brinkcommerce.com/productv1/products \
--header 'content-type: application/json' \
--header 'x-api-key: ${product api key}' \
--data '[{
"id": "product-variant-id",
"name": "Black socks size 9",
"type": "productVariant",
"category": "Socks",
"price": [{
"currencyUnit": "SEK",
"amount": 20000
}],
"relatedProduct": "product-id"
}]'
Create add-on
curl --request POST \
--url https://api.${env}.brinkcommerce.com/productv1/products \
--header 'content-type: application/json' \
--header 'x-api-key: ${product api key}' \
--data '[{
"id": "addon-id",
"name": "Engraving",
"type": "addon",
"category": "Add-on",
"price": [{
"currencyUnit": "SEK",
"amount": 5000
}],
}]'
Get product
curl --request GET \
--url https://api.${env}.brinkcommerce.com/productv1/products/product-id
Get products
curl --request GET \
--url 'https://api.${env}.brinkcommerce.com/productv1/products?ids=product-id,product-variant-id,addon-id'
Update product(s)
curl --request PUT \
--url https://api.${env}.brinkcommerce.com/productv1/products \
--header 'content-type: application/json' \
--header 'x-api-key: ${product api key}' \
--data '[
{
"id": "product-id",
"slug": "/t-shirt"
}
]'
Link add-ons to a products
Add-ons can be linked to products either by 1) supplying a list of compatible product id:s when creating/updating an add-on,
or 2) by supplying a list of compatible add-ons when creating/updating a product. Choose the method that is most suitable
for your product/add-on structure. Note! addon
links to product
, not productVariant
.
Link add-ons to a product
curl --request PUT \
--url https://api.${env}.brinkcommerce.com/productv1/products \
--header 'content-type: application/json' \
--header 'x-api-key: ${product api key}' \
--data '[{
"id": "product-id",
"compatibleAddons": [ "addon-id" ]
}]'
It is also possible to link add-ons to a product when first creating the product by adding the compatibleAddons
field, see Create product.
Link products to an add-on
curl --request PUT \
--url https://api.${env}.brinkcommerce.com/productv1/products \
--header 'content-type: application/json' \
--header 'x-api-key: ${product api key}' \
--data '[{
"id": "addon-id",
"compatibleProducts": [ "product-id" ]
}]'
It is also possible to link products to an add-on when first creating the add-on by adding the compatibleProducts
field, see Create product.
Search
All product are indexed in Elasticsearch. We support Elasticsearch query DSL
curl --request POST \
--url https://api.${env}.brinkcommerce.com/productv1/products/search \
--header 'content-type: application/json' \
--header 'x-api-key: ${product api key}' \
--data '{
"query": {
"match": {
"name": "t-shirt"
}
}
}'
#Multiple Warehouse
-
Products exist in Brink for processing orders and transaction purposes only,
-
Recommended is to limit information in Brink to transactional necessary information only.
-
If extra infromation is needed to be stored in Brink this is recommended to be added and stored using the customerAttribute object.
-
Setting up a product is done using the product managenent API. Model Product has 5 different types:
{ "firstName": "John", "lastName": "Smith", "age": 25 }