2. Classifications

120In order to import the hierarchy from your ERP, you'll need to create and manage each of the individual classification hierarchy levels.

To create the hierarchy shown here, you must create the top levels first and then the lower (sub)levels.
239



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

  • Create new classifications
  • Modify existing classification data
  • Delete existing classifications

Create Classifications

To create classifications, you must know where in the hierarchy it will be located and define its unique code and identify its parent classification's unique code. You can also include attributes for the classification and specify its data language.

URL Parameters
Endpoint/classifications API v4 endpoint

🚧

This endpoint is unitary and creates a single resource at a time, in a single data language. To specify content in a specific data language, you must use the target_culture query parameter (see code example).

HTTP MethodPOST
Query Parameters
target_culturestringCode of the data locale.
Request Body
Required Attributescodestring The unique code of the classification to be created.
parent_codestringThe unique code of the new classification's parent classification. This is defines its location in the hierarchy and is only required during creation of the classification.

To create a first-level (highest) classification, the parent is the master classification (root).
Accepted Attributes{{_attribute_}}string Any attribute code with its value(s) (e.g., name and description in code example).

Example

import requests
url= "https://{{YOUR-PIM}}.quable.com.quable.com/api_1.php/classifications?target_culture=en_US"
payload={
    "code" : "subfamily_12",
    "parent_code": "family_12",
    "name": "Shoes",
    "description": "Shoes are an item of clothing whose role is to protect the feet."
}
headers= {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer ...'
}
response= requests.request("POST", url, headers=headers, data=payload)



Edit Classifications

To edit a classification, you must identify the classification's unique code.

URL Parameters
Endpoint/classifications/{code}

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

🚧

This endpoint is unitary and modifies 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 query parameter (see code example).

HTTP MethodPUT
Query Parameters
codestringCurrent unique code of the classification to update.
target_culturestringCode of the data locale.
Request Body
Accepted Attributes{{_attribute_}}string Any attribute code with its value(s) (e.g., name in code example).
codestringNew unique code of the classification.
parent_codestringUnique code of the parent classification. If modified, the classification will be moved to the new parent_code

Example

import requests
url= "https://{{YOUR-PIM}}.quable.com.quable.com/api_1.php/classifications/{{code}}?target_culture=fr_FR"
payload={
    "code" : "NEW_CODE",
    "name": "Chaussures"
}
headers= {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer ...'
}
response= requests.request("PUT", url, headers=headers, data=payload)



Delete Classifications

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

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

❗️

If a classification is deleted:

  • All of its child classifications are also deleted.
  • All related objects (documents, variants, assets) become orphans (unclassified).
URL Parameters
Endpoint/classifications/{code}

Note: {code} is the unique code of the classification to delete.
API v4 endpoint
HTTP MethodDELETE
Query Parameters
codestringUnique code of the classification to delete.

Example

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