How do you fetch custom attribute definitions for Selection Properties

When I fetch items from catalogue, the custom attributes that I retrieve include selection list attributes. It’s ridiculous that it only returns the ids of those select attributes (selectionUidValues, customAttributeDefinitionId) and not their name and other information. The Square API is plagued with Ids for composition but at the risk of convolution, needless logic/boilerplate and multiple requests. How do I fetch CatalogCustomAttributeDefinitions?

You can use SearchCatalogObjects endpoint and search for it. If you have the name of the selection (which you should, if you see the uids), then you can do something like:

{
  "object_types": [
    "CUSTOM_ATTRIBUTE_DEFINITION"
  ],
  "query": {
      "exact_query": {
          "attribute_name": "name",
          "attribute_value": "Selection Name Here"
      }
  }
}

as the request. The response will have the allowed_selections with the uid and name of the selection. I’ll share this feedback with the team, though.

1 Like