Creating a product and variant

Now, we must create a product and a product variant.

Create product

curl --request PUT \
  --url https://management.eu-west-1.{env}.brinkcommerce.io/product/product-parents/t-shirt-1 \
  --header 'Authorization: Bearer {token}' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: {api-key}' \
  --data '{
  "name": "t-shirt-1",
  "displayNames": {"en":"t-shirt-1"},
  "description": "t-shirt",
  "displayDescriptions": {"SE":"t-shirt-1"},
  "imageUrl": "https://example.com/t-shirt.png",
  "isActive": true,
  "customAttributes": {"Attributes":"hidden"},
  "tags": {"brand": ["t-shirt brand"]}
}'

Create product variant

curl --request PUT \
  --url https://management.eu-west-1.{env}.brinkcommerce.io/product/product-variants/t-shirt-1.s \
  --header 'Authorization: {token}' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: {api-key}' \
  --data '{
  "taxGroupId":{taxGroupId},
  "imageUrl": "https://example.com/t-shirt.png",
  "name": "t-shirt small",
  "displayNames": {"en":"t-shirt small"},
  "description": "t-shirt small",
  "weight": 1000,
  "displayDescriptions": {"SE":"t-shirt small"},
  "isActive": true,
  "productParentId": "t-shirt-1",
  "customAttributes": {},
  "tags": {},
  "dimensions": {
    "width": 0,
    "length": 0,
    "height": 0
	}
  }'

Connect product variant to inventory

  curl --request PUT \
  --url https://management.eu-west-1.{env}.brinkcommerce.io/stock/product-variants/t-shirt-1-s/inventories/{inventoryId} \
  --header 'Authorization: {token}' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: BrinkCommerceDefaultApiKey' \
  --data '{
"quantity": 1337
  }'

Prices

Last step is to set prices on the product

  curl --request PUT \
  --url https://management.eu-west-1.{env}.brinkcommerce.io/price/store-groups/{storeGroupId}/product-variants/t-shirt-1.s/prices \
  --header 'Authorization: {token}' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: BrinkCommerceDefaultApiKey' \
  --data '{
  "productVariantPrices": [
    {
      "basePriceAmount": 50000,
      "countryCode": "SE",
      "salePriceAmount": 10000
    },
    {
      "basePriceAmount": 5000,
      "countryCode": "NL",
      "salePriceAmount": 1000
    },
    {
      "basePriceAmount": 5000,
      "countryCode": "GB",
      "salePriceAmount": 1000
    }
  ]
  }'

Next step: Start cart session

With your Brink environment set up, it's time to start integrating with the API and create your first order.