Create and connect variants

How to create and connect variants using Management API

The variant concept in Bluestone PIM involves a variant group product with link to one or more variant products. Some systems call this mother and child or product and item. 

The advantage of working with variants is that common attributes can be managed on the variant group level and inherited by the variants. 

This article does not contain details about creating products, see this article for more information about that.

Create a variant group product

URL

POST https://mapi.bluestonepim.com/pim/products

Request body

{
  "type": "GROUP",
  "name": "Shirt",
  "number": "shirt-1",
  "description": "This is a description of a shirt"
}

Response

If successful, this will result in a 201 - Created response.

The response headers will include a resource-id with the GUID of the newly created product. 

Try it in readme.io

Create a variant product

Create the variants as SINGLE products. PIM will automatically change them to VARIANT once they have been added to a group.

URL

POST https://mapi.bluestonepim.com/pim/products

Request body

{
  "type": "SINGLE",
  "name": "Red shirt",
  "number": "shirt-1-red",
  "description": ""
}

Response

If successful, this will result in a 201 - Created response.

The response headers will include a resource-id with the GUID of the newly created product. 

Try it in readme.io

Assign variant to variant group

This endpoint must be called for each variant in the group.

URL

PUT https://mapi.bluestonepim.com/pim/products/{id}/variants/{variantProductId}

  • id: Variant group id
  • variantProductId: Variant product id

Request body

No request body

Response

Returns "204 - No content" if successful 

Try it in readme.io