Add a matrix attribute to product

How to add a matrix attribute to product using Management API

This article explains the column attribute only. See main page for general information about adding product attributes. 

Add matrix attribute with value to product

URL

POST https://mapi.bluestonepim.com/pim/products/{id}/attributes/matrix

Request body

{
  "definitionId": "{attribute id}",
   "matrix": {
        "60869b2b6b2f07000cacff76": {
            "60869b2b6b2f07000cacff75": "First row first column value",
            "60869b4c6b2f07000cacff78": "Second row first column value"
        },
        "60869b4c6b2f07000cacff79": {
            "60869b2b6b2f07000cacff75": "First row second column value",
            "60869b4c6b2f07000cacff78": "Second row second column value"
        }
    },
}

Use attribute id in definitionId. In the matrix property, the keys are a row and a column id's from the attribute definition.
See how to get attribute definition and value id's.  

Response

If successful, this will result in a 201 - Created response. This means the attribute has been added to the product with the values.