4. Variants

Variants are associated to documents to describe different versions of a product such as color, size, etc.

🚧

A variant can only have a single parent document.

There are three possible steps to ensure that your variants are imported correctly:

  • Create new variants
  • Modify existing variant data
  • Delete existing variants


Create Variants

To create a new variant, you must include the variant's code and the code of the document to which it will be associated.

URL Parameters
Endpoint/variantsAPI v4 endpoint

🚧

This endpoint is unitary and creates a single resource at a time, in a single data language. In order to specify content in a specific data language, you need to use the target_culture URL parameter (see code example).

HTTP MethodPOST
Query Parameters
target_culturestringCode of the data locale.
Request Body
Required Attributescodestring The unique code of the variant to be created.
document_codestring The unique code of the document to which the variant will be assigned. This is only required during variant creation.

Accepted AttributesactivebooleanIf False, the variant becomes inactive and is unavailable via the interface.
{{_attribute_}}string Any attribute code with its value(s). (e.g., variant_label or ean13 in code example)

Example

import requests
url = "https://{{YOUR-PIM}}.quable.com.quable.com/api_1.php/variants?target_culture=en_US"
payload={
    "document_code": "blue_suede_shoe",
    "code": "blue_suede_shoe_43-44",
    "variant_label": "Blue Suede Shoe : 43/44",
    "ean13": "0123456789987",
    "variant_sellable": true
        "variant_erp_statuses": [{
                "code": "N1"
        },{
                "code": "A20"
        }]
}
headers= {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer ...'
}
response= requests.request("POST", url, headers=headers, data=payload)



Edit Variants

To update an existing document variant, you must identify the variant's unique code.

URL Parameters
Endpoint/variants/{{code}}

Note: {{code}} is the unique code of the variant to update.
API v4 endpoint

🚧

This endpoint is unitary and creates a single resource at a time, in a single data language. In order to specify content in a specific data language, you need to use the target_culture URL parameter (see code example).

HTTP MethodPUT
Query Parameters
target_culturestring Code of the data locale.
Request Body
Required Attributescodestring The unique code of the variant to be created.
document_codestring The unique code of the document to which the variant will be assigned. This is only required during variant creation.

Accepted Attributesactiveboolean If False, the variant becomes inactive and is unavailable via the interface.
{{_attribute_}}string Any attribute code with its value(s). (e.g., variant_label in code example)

Example

import requests
url= "https://{{YOUR-PIM}}.quable.com.quable.com/api_1.php/variants/blue_suede_shoe_43-44?target_culture=fr_FR"
payload={
    "code": "blue_suede_shoe_43-44",
    "variant_label": "Blue Suede Shoe : 43/44"
}
headers= {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer ...'
}
response= requests.request("PUT", url, headers=headers, data=payload)



Delete Variants

It may become necessary at some point to delete a variant from Quable PIM (e.g., to synchronize with a change in your ERP).

To delete a variant, you must identify the variant's unique code.

👍

When a variant is deleted, no other object is impacted except the parent document (its completeness and status are automatically recalculated and its modification date updated).

URL Parameters
Endpoint/variants/{{code}}

Note: {{code}} is the unique code of the variant to delete.
API v4 endpoint
HTTP MethodDELETE
Request Body
Required Attributescodestring The unique code of the variant to be deleted.

Example

import requests
url= "https://{{YOUR-PIM}}.quable.com.quable.com/api_1.php/variants/blue_suede_shoe_43-44"
headers= {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer 883ae3ca7d90f91542227dc8d0d38b46'
}
response= requests.request("DELETE", url, headers=headers)