Find a product

How to find a product using Management API


Use PIM to look up products by id      Use PIM to look up products by number
Use search to find the product by other properties



Use PIM to look up products by id

If you have the Bluestone PIM product id you can use this endpoint. If not, you can use the search to find the id. 

URL

POST 
https://api.bluestonepim.com/pim/products/list/views/by-ids

Request body

{
    "ids": [
       "625fea934cedfd00013888dc"
    ],
    "views": [
        {"type": "ASSETS"},
        {"type": "ATTRIBUTES"},
        {"type": "METADATA"},
        {"type": "CATEGORIES"},
        {"type": "BUNDLES"},
        {"type": "LABELS"},
        {"type": "VARIANTS"},
        {"type": "RELATED_PRODUCTS"},
        {"type": "RELATED_CATEGORIES"}
    ]
}

The endpoint accepts a list of ids, but here we send only one. The views property accepts a list of types, this corresponds to the properties returned for the product. Here we have listed all types, but it is good practice to only get the information needed. 

Response

{
    "data": [
        {
            "id": "625fea934cedfd00013888dc",
            "metadata": {
                "name": {
                    "value": {
                        "en": "Single sample product"
                    }
                },
                "number": "123456",
                "description": {
                    "value": {}
                },
                "state": "PLAYGROUND_ONLY",
                "contextStates": {},
                "archived": false,
                "lastUpdate": 1651058709784,
                "createDate": 1650453139534,
                "type": "SINGLE",
                "dataSynced": false,
                "readOnly": false
            },
            "attributes": [
                {
                    "definitionId": "5da7254de21b84000c6ed075",
                    "value": {
                        "value": {
                            "en": "Sample text"
                        }
                    }
                },
                {
                    "definitionId": "5db038fcd60180000cf9851e",
                    "select": [
                        "5db038fcd60180000cf9851c"
                    ],
                    "contextAwareSelect": {
                        "value": {
                            "en": [
                                "5db038fcd60180000cf9851c"
                            ]
                        }
                    }
                },
                {
                    "definitionId": "60869a7c6b2f07000cacff73",
                    "value": {
                        "value": {
                            "en": "true"
                        }
                    }
                }
            ],
            "assets": [
                "918655ba-5f85-48b7-8ccb-7e3d1fe96e73"
            ],
            "productBundles": [],
            "categories": [
                "5d78f916ee3588000c7686e5"
            ],
           "labels": [
                "62692d29713c0900014eeace",
                "62692d29713c0900014eeacf"
            ],
            "productVariants": [],
            "relatedProducts": [
                {
                    "relationId": "61827e914cedfd00012d8b47",
                    "relatedId": "609a822a590801000d931e57",
                    "reverse": false
                }
            ],
            "relatedCategories": []
        }
    ]
}

This returns a list of products matching the ids in the request, in this case only one. 

Metadata

The property contains the basic product properties like name, number, state and timestamps.

Attributes

List of attributes with attribute id's and values. This product has three attributes. One Text attribute, one Single select attribute and one Boolean attribute.

Assets

List of asset id's. This product only has one asset.

Product bundles

This is a single product. If it had been a bundle product, this property would have contained a list of the product id's in the bundle.

Labels

List of label id's. This product has two labels.

Product variants

This is a single product. If it had been a variant group product, this property would have contained a list of the variant product id's.

Related products

Contains a list of all product relations. This product only has one. Each element has three properties:

  • relationId: The id of the relation
  • relatedId: The id of the related product
  • reverse: True if this is the reverse direction of a two-way relation. Otherwise false. 

Related categories

Legacy property that is not in use.

Try it in readme.io

Use PIM to look up products by number

URL

POST 
https://api.bluestonepim.com/pim/products/list/views/by-numbers

Request body

{
  "numbers": [
     "1234567",
"7654321"
    ],
    "views": [
        {"type": "ASSETS"},
        {"type": "ATTRIBUTES"},
        {"type": "METADATA"},
        {"type": "CATEGORIES"},
        {"type": "BUNDLES"},
        {"type": "LABELS"},
        {"type": "VARIANTS"},
        {"type": "RELATED_PRODUCTS"},
        {"type": "RELATED_CATEGORIES"}
    ]
}

The endpoint accepts a list of numbers. The views property works the same way as for the "by-ids" endpoint.

Response

The endpoint returns a list of products matching the numbers in the request, the response is the same as for the "by-ids" endpoint.

Try it in readme.io

Use search to find the product by other properties

When finding products using filters in Bluestone PIM, the UI application uses the search endpoint.

It is possible to filter products by attribute values, category assignments, labels, relations, completeness score, assets and more. 

Using a network inspector in the browser it is possible to see and copy the request payload. In this example, we search for a product number:

URL

POST https://api.bluestonepim.com/core-search/products/search 

Request body

{
   "page": 0,
    "pageSize": 20,
"assetFilters": null,
    "attributeFilters": [],
    "attributeIdToSortBy": null,
    "baseFilters": [
        {
            "type": "NUMBER_IS",
            "values": [
                "123456"
            ]
        }
    ],
    "categoryFilters": null,
    "column": null,
  "labelFilters": [],  
    "productCreateDateFilter": [],
    "productLastUpdateFilter": [],
    "productLastUpdateRelativeFilter": null,
    "publishStateFilter": null,
    "relationsFilter": null,
    "scoreFilter": null,
    "scoreRequirementResultFilters": null,
    "sortDirection": null,
    "typeFilter": null,
    "typesFilter": null
}

Response

{
    "data": [
        {
            "id": "625fea934cedfd00013888dc"
        }
    ]
}

This returns a list of products matching the filters, in this case only one. Use the "by-ids" endpoint if you need more information about the product.  

Try it in readme.io