Variants are associated to documents to describe different versions of a product such as color, size, etc.
|
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 | /variants | API v4 endpoint
| |
HTTP Method | POST | ||
Query Parameters | |||
target_culture | string | Code of the data locale. | |
Request Body | |||
Required Attributes | code | string | The unique code of the variant to be created. |
document_code | string | The unique code of the document to which the variant will be assigned. This is only required during variant creation. | |
Accepted Attributes | active | boolean | 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 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
| |
HTTP Method | PUT | ||
Query Parameters | |||
target_culture | string | Code of the data locale. | |
Request Body | |||
Required Attributes | code | string | The unique code of the variant to be created. |
document_code | string | The unique code of the document to which the variant will be assigned. This is only required during variant creation. | |
Accepted Attributes | active | boolean | 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. |
|
URL Parameters | |||
Endpoint | /variants/{{code}} Note: {{code}} is the unique code of the variant to delete. | API v4 endpoint | |
HTTP Method | DELETE | ||
Request Body | |||
Required Attributes | code | string | 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)