Predefined Values - Retrieve

👍

Objective

This cookbook explains two ways to find Predefined Values from Quable PIM.

Process Overview

Retrieving your list values is accomplished with a simple GET request to Quable PIM API. In this call, you can retrieve:

All list values

To retrieve all list values, you can send the request without any attributes.

URL Parameters
Endpoint/predefined-valuesAPI v5 endpoint

📘

This endpoint provides a paginated list of predefined values.

HTTP MethodGET

Example

This example is a call to retrieve 1 page of 30 list values.

import requests

url = "https://{{YOUR-PIM}}.quable.com/api/predefined-values?page=1&limit=30"

payload={}
headers = {
  'Authorization': 'Bearer READ_ACCESS_TOKEN',
  'Content-Type': 'application/json'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

The JSON response from Quable PIM includes a single page of 30 list values:

{
    "hydra:member": [
        {
            "attribute": {
                "id": "size"
            },
            "name": {
                "fr_FR": "Large",
                "en_US": "Large"
            },
            "dateCreated": "2021-10-06T14:33:46+00:00",
            "dateModified": "2021-10-06T14:33:46+00:00",
            "id": "attribute=color;code=L"
        },
        {
            "attribute": {
                "id": "color"
            },
            "name": {
                "fr_FR": "Rouge",
                "en_US": "Red"
            },
            "dateCreated": "2021-10-06T14:33:46+00:00",
            "dateModified": "2021-10-06T14:33:46+00:00",
            "id": "attribute=color;code=red"
        },
        {
            "attribute": {
                "id": "color"
            },
            "name": {
                "fr_FR": "Rouge",
                "en_US": "Red"
            },
            "dateCreated": "2021-10-06T14:33:46+00:00",
            "dateModified": "2021-10-06T14:33:46+00:00",
            "id": "attribute=color;code=red"
        }
    ],
    "hydra:totalItems": 3
}

List values for a specific attribute.

To retrieve the list values for a specific attribute, you must include the attribute's id (code).

URL Parameters
Endpoint/predefined-values?attribute.id={{code}}API v5 endpoint

📘

This endpoint provides a paginated list of predefined values.

HTTP MethodGET
Request Body
Accepted Attributesattribute.idstringThe unique identifier of the predefined value.
attribute.id[]array(string)Array of unique identifiers(attribute.id) of multiple predefined values.
pageintegerThe collection page number.
limitintegerThe number of items per page.
paginationboolean
  • If True, pagination is enabled.
  • If False, pagination is disabled.

Example

import requests
import json

url = "https://{{YOUR-PIM}}.quable.com/api/predefined-values?attribute.id=color"

payload={}
headers = {
  'Authorization': 'Bearer OAUTH_ACCESS_TOKEN',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

The JSON response from Quable PIM includes all of the list values for the specified attribute. The following is an example of a response:

{
    "hydra:member": [
        {
            "attribute": {
                "id": "color"
            },
            "name": {
                "fr_FR": "Rouge",
                "en_US": "Red"
            },
            "dateCreated": "2021-10-06T14:33:46+00:00",
            "dateModified": "2021-10-06T14:33:46+00:00",
            "id": "attribute=color;code=red"
        },
        {
            "attribute": {
                "id": "color"
            },
            "name": {
                "fr_FR": "Rouge",
                "en_US": "Red"
            },
            "dateCreated": "2021-10-06T14:33:46+00:00",
            "dateModified": "2021-10-06T14:33:46+00:00",
            "id": "attribute=color;code=red"
        }
    ],
    "hydra:totalItems": 2
}