How to find an attribute using Management API
Get list of attribute definitions
To use attributes in MAPI, it is often necessary to know the Bluestone PIM attribute id. Since the id will change between environments it is recommended to use the number as a permanent identifier.
Use this endpoint to look up the attribute ID based on the number.
If you don't know the attribute number or id, you can get the complete list of attributes and use text search to find by name instead.
Attribute changes are often rare, so it is a good practice to cache results for a while. Avoid calling this endpoint before every product update for example.
Learn more about attributes in Bluestone PIM.
URL
POST https://api.bluestonepim.com/pim/definitions/list
Request body
{
"filters": [
{
"values": [
"text-attribute-example",
"single-select-attribute-example"
],
"type": "NUMBER_IN"
}
],
"page": 0,
"pageSize": 20
}
It is possible to filter on type NUMBER_IN or ID_IN and the values property accepts a list of strings. If the filter property is omitted, all attributes will be returned. Paginate through the results using page and pageSize.
Response
{
"data": [
{
"name": "Text attribute example",
"number": "text-attribute-example",
"groupId": "5d9486facff47e000e0a9287",
"externalSource": false,
"internal": false,
"dataType": "text",
"restrictions": {
"text": {
"whitespaces": true
}
},
"charset": "UTF-8",
"unit": "",
"id": "5da7254de21b84000c6ed075",
"isCompound": false,
"group": "Attribute group A",
"description": "This is a description for the attribute",
"toBeRemoved": false
},
{
"name": "Single select attribute example",
"number": "single-select-attribute-example",
"groupId": "5d9486facff47e000e0a9287",
"externalSource": false,
"internal": false,
"dataType": "single_select",
"restrictions": {
"enum": {
"values": [
{
"valueId": "5db038fcd60180000cf9851c",
"value": "Value A",
"number": "value-a"
},
{
"valueId": "60a658b2cff47e000c106394",
"value": "Value B",
"number": "value-b"
},
{
"valueId": "5fabee6f590801000c1635e3",
"value": "Value C",
"number": "value-c"
}
]
}
},
"charset": "UTF-8",
"unit": "",
"id": "5db038fcd60180000cf9851e",
"isCompound": false,
"group": "Attribute group A",
"toBeRemoved": false
}
]
}
Responds with a list of attributes matching the filters, in this case, two.