Create/Update and Delete Attributes

Instructions

When creating an attribute, our API will return a unique "ID" for that attribute, allowing you to change or delete it whenever you like.

Example of Attributes creation

{
    "attributes": [
        {
            "value": {
                "code": "Único",
                "label": "Único"
            },
            "label": "Tamanho",
            "code": "Tamanho"
        },
        {
            "value": {
                "code": "Amarelo",
                "label": "Amarelo"
            },
            "label": "Cor",
            "code": "Cor"
        }
    ]
}

Example of Attributes return

Example of return after the creation of attributes, see that when creating it generated an "id".

{
    "attributes": [
        {
            "value": {
                "code": "Único",
                "label": "Único"
            },
            "label": "Tamanho",
            "code": "Tamanho",
            "attribute_diff": null,
            "id": "60d0814100ae017c40ea58a8"
        },
        {
            "value": {
                "code": "Amarelo",
                "label": "Amarelo"
            },
            "label": "Cor",
            "code": "Cor",
            "attribute_diff": null,
            "id": "60d0814100ae017c40ea58a9"
        }
    ]
}

Update Example

In this example update I will change the attribute value from "Único" to "P" .

I'm going to use the attribute's "id" to make this change.

{
    "attributes": [
        {
            "value": {
                "code": "P",
                "label": "P"
            },
            "label": "Tamanho",
            "code": "Tamanho",
            "id": "60d0814100ae017c40ea58a8"
        }
    ]
}

Example of Attributes return

{
    "attributes": [
        {
            "value": {
                "code": "P",
                "label": "P"
            },
            "label": "Tamanho",
            "code": "Tamanho",
            "attribute_diff": null,
            "id": "60d0814100ae017c40ea58a8"
        },
        {
            "value": {
                "code": "Amarelo",
                "label": "Amarelo"
            },
            "label": "Cor",
            "code": "Cor",
            "attribute_diff": null,
            "id": "60d0814100ae017c40ea58a9"
        }
    ]
}

Deleting Attributes

To delete an attribute, just inform the corresponding "id" and send the "remove" with value "true" .

{
    "attributes": [
        {
            "remove": true,
            "id": "60d0814100ae017c40ea58a8"
        }
    ]
}
Language
Click Try It! to start a request and see the response here!