# Variant Search

The Procurement Consumer API allows you to search for article variants of a given supplier with advanced filtering options.

Search results will always return a list of matching Variant objects with their associated Articles.

# Request

To use the variant Search API, perform a GET request on one of the following endpoinst: https://procurement.zaikio.com/{article_type}/{supplier_id}/searches https://procurement.zaikio.com/{article_type_or_supplier_id}/searches

Requests need to be authenticated and require an Organization bearer as well as either one of the following scopes: procurement_consumer.catalog.r procurement_consumer.catalog.rw.

Provide the following arguments:

Argument Description
query The actual search query
page Search result page that shall be returned (default: 1)
per_page Search results that shall be returned per page (default: 25)

# Optional Arguments

Each requests is allowed to have further optional arguments. All allowed arguments can be found within the API documentation (opens new window).

# Search Operators

Most search fields accept further operators that allow narrowing down your search:

Operator Example Restrictions Description
Array &width[]=130&width[]=180 Will result in a search within all provided values
Greater than &width[gt]=130 Only numeric fields Will result in a search with width larger than 130
Greater than or equal to &width[gte]=130 Only numeric fields Will result in a search with width larger than equal than 130
Less than &width[lt]=250 Only numeric fields Will result in a search with width less than 250
Less than or equal to &width[lte]=250 Only numeric fields Will result in a search with width less than or equal to 250

# Example Request

# Request

https://procurement.zaikio.com/consumers/api/v1/substrate/b1475f65-236c-58b8-96e1-e1778b43beb7/search?query=VOLUME&per_page=2&width[]=880&width[]=920&height[gte]=630&category=PS1%20-%20Premium%20Coated

This request will search for all variants of the supplier with the id b1475f65-236c-58b8-96e1-e1778b43beb7, where the following criteria are met:

  • Queryable fields contain: VOLUME
  • Returns two entries per page
  • Width of the variants are equal to: 880 or 920
  • Height of the variants are greater than or equal to 630
  • The variant category is: PS1 - Premium Coated

# Response

The response returns two arrays results and facets. The former will be a List of matching Variants. The latter is a list of search facets that can be used to further narrow down the results.

{
    "results": [
        {
            "id": "84f9b500-0871-568e-82a9-e47630e94ac5",
            "form": "sheet",
            "category": "PS1 - Premium Coated",
            "unit_system": "metric",
            "width": 920,
            "height": 650,
            "thickness": 96,
            "paper_weight": 90,
            "paper_weight_unit": "grammage",
            "grain": "short",
            "color": "red",
            "transparency": null,
            "whiteness": null,
            "brightness": null,
            "roughness": null,
            "created_at": "2020-11-15T09:18:41.760Z",
            "updated_at": "2020-11-15T09:18:41.760Z",
            "article": {
                "id": "5abfc85f-77a4-5acb-aa8a-d0b02790e237",
                "base_unit": "sheet",
                "coated": "both sides",
                "description": null,
                "finish": "MATT COATED",
                "kind": "paper",
                "name": "MAGNO VOLUME",
                "supplier_id": "b1475f65-236c-58b8-96e1-e1778b43beb7",
                "supplier": {
                    "id": "b1475f65-236c-58b8-96e1-e1778b43beb7",
                    "display_name": "Bounty Soap Inc.",
                    "links": [
                        {
                            "rel": "self",
                            "href": "/consumers/api/v1/suppliers/bounty_soap_inc"
                        }
                    ]
                },
                "created_at": "2020-11-15T09:18:41.802Z",
                "updated_at": "2020-11-15T09:18:41.802Z"
            },
            "available_environmental_certifications": [
                "FSC Mix Credit",
                "PEFC 100%"
            ]
        },
        {
            "id": "89082a57-af5c-53a2-a66c-81e269c86ebe",
            "form": "sheet",
            "category": "PS1 - Premium Coated",
            "unit_system": "metric",
            "width": 880,
            "height": 630,
            "thickness": 86,
            "paper_weight": 80,
            "paper_weight_unit": "grammage",
            "grain": "short",
            "color": "red",
            "transparency": null,
            "whiteness": null,
            "brightness": null,
            "roughness": null,
            "created_at": "2020-11-15T09:18:41.760Z",
            "updated_at": "2020-11-15T09:18:41.760Z",
            "article": {
                "id": "5abfc85f-77a4-5acb-aa8a-d0b02790e237",
                "base_unit": "sheet",
                "coated": "both sides",
                "description": null,
                "finish": "MATT COATED",
                "kind": "paper",
                "name": "MAGNO VOLUME",
                "supplier_id": "b1475f65-236c-58b8-96e1-e1778b43beb7",
                "supplier": {
                    "id": "b1475f65-236c-58b8-96e1-e1778b43beb7",
                    "display_name": "Bounty Soap Inc.",
                    "links": [
                        {
                            "rel": "self",
                            "href": "/consumers/api/v1/suppliers/bounty_soap_inc"
                        }
                    ]
                },
                "created_at": "2020-11-15T09:18:41.802Z",
                "updated_at": "2020-11-15T09:18:41.802Z"
            },
            "available_environmental_certifications": [
                "FSC Mix Credit",
                "PEFC 100%"
            ]
        }
    ],
    "facets": [
        {
            "name": "environmental_certifications",
            "total_count": 2,
            "options": [
                {
                    "value": "FSC Mix Credit",
                    "count": 2
                },
                {
                    "value": "PEFC 100%",
                    "count": 2
                }
            ]
        },
        {
            "name": "height",
            "total_count": 2,
            "options": [
                {
                    "value": 630,
                    "count": 1
                },
                {
                    "value": 650,
                    "count": 1
                }
            ]
        },
        {
            "name": "paper_weight",
            "total_count": 2,
            "options": [
                {
                    "value": 80,
                    "count": 1
                },
                {
                    "value": 90,
                    "count": 1
                }
            ]
        },
        {
            "name": "thickness",
            "total_count": 2,
            "options": [
                {
                    "value": 86,
                    "count": 1
                },
                {
                    "value": 96,
                    "count": 1
                }
            ]
        },
        {
            "name": "width",
            "total_count": 3,
            "options": [
                {
                    "value": 880,
                    "count": 1
                },
                {
                    "value": 920,
                    "count": 1
                },
                {
                    "value": 1200,
                    "count": 1
                }
            ]
        }
    ]
}