Find fields & predefined values

If you need to retrieve all or a subset of the predefined-values from the PIM, here's a solution.

FYI : while pulling your documents via the API, predefined values are also returned : https://docs.quable.com/reference#retrieve-documents-variants-links

Find fields that use Predefined values

This API endpoint with the given parameter will return a paginated collection of fields (that are using predefined values)

curl -i -X GET \
   -H "Authorization:Bearer OAUTH_ACCESS_TOKEN" \
 'https://PIM_INSTANCE.quable.com/api_1.php/eav-attributes?start=0&limit=50&assist=1'

Available parameters are :

  • document_type_code : unique code of a document type. If given, returned fields will be filtered, according to the parameter value
  • attribute_set_code : unique code a an attribute set. If given, returned fields will be filtered, according to the parameter value

The response HTTP header code is 200.
The response body will be a JSON object composed of :

  • page : current page
  • total : total number of fields available, according to the parameters
  • records : current number of fields returned in the response
  • rows.code : unique code of the field
  • rows.name : name of the field in the current locale
{
    "page" : 1,
    "total" : 123,
    "records" : 50
    "success": true,
    "rows": [
        {
            "id": 16787,
            "code": "brand",
            "name": "Marque",
            ...
        },
        {
            "id": 16788,
            "code": "color",
            "value": "Couleur",
            ...
        },
        {
            ...
        }
        ...
    ]
}

Find predefined values

Predefined values configured in the PIM for a given field and a given culture can be found via the endpoint eav_attributes/FIELD/values?culture=CULTURE
Here's an example with a field which unique code is brand

curl -i -X GET \
   -H "Authorization:Bearer OAUTH_ACCESS_TOKEN" \
 'https://PIM_INSTANCE.quable.com/api_1.php/eav_attributes/brand/values?culture=xx_XX'

The response will be composed of a collection of row with the following attributes :

  • id : Quable identifier
  • code : unique code of the predefined value (scope at the field level)
  • value : label of the value in the given culture
  • description : description of the value in the given culture
{
    "success": true,
    "rows": [
        {
            "id": 16787,
            "code": "brand_nike",
            "value": "Nike",
            "value_default": "Nike",
            "description": "lorem ipsum"
        },
        {
            "id": 16788,
            "code": "brand_adidas",
            "value": "Adidas",
            "value_default": "Adidas",
            "description": ""
        },
        {
            "id": 16786,
            "code": "brand_coq",
            "value": "Le coq sportif",
            "value_default": "soleil",
            "description": ""
        }
    ],
    "total": 3
}