How to get filter values for a product
Function getFilterValues
The filter values endpoint returns the available colors, sizes, and other attributes you can use to filter inventory queries. This is useful for building dynamic filter UIs or validating filter parameters before querying inventory.
HTTP VERB: GET
URL: https://api.psrestful.com/v2.0.0/suppliers/{SUPPLIER_CODE}/inventory/filter-values/{PRODUCT_ID}/
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
product_id_type | string | No | Type of product ID being used |
environment | string | No | Environment: PROD or STAGING (default: PROD) |
Example Request
curl -X GET "https://api.psrestful.com/v2.0.0/suppliers/HIT/inventory/filter-values/55414/" \
-H "X-API-Key: your-api-key"Example Response
This is the response from calling with:
SUPPLIER_CODE = HIT
PRODUCT_ID = 55414
{
"FilterValues": {
"productId": "55414",
"Filter": [
{
"filterType": "COLOR",
"filterValue": [
"WHITE",
"BLACK",
"RED",
"NAVY BLUE",
"SILVER",
"TEAL"
]
},
{
"filterType": "SIZE",
"filterValue": [
"14OZ"
]
}
]
},
"ServiceMessageArray": null
}Response Structure
| Field | Description |
|---|---|
productId | Product identifier |
Filter | Array of filter types and their available values |
filterType | Type of filter (e.g., COLOR, SIZE) |
filterValue | Array of available values for this filter type |
Common Filter Types
| Type | Description |
|---|---|
COLOR | Available colors for the product |
SIZE | Available sizes (for apparel, drinkware, etc.) |
LABEL_SIZE | Label size designations |
Typical Workflow
- Call this endpoint to get available filter values
- Build a filter UI based on the response
- Use selected filters when calling Get Inventory Levels
# Example: Build filters and query inventory
import requests
# Step 1: Get filter values
filter_response = requests.get(
"https://api.psrestful.com/v2.0.0/suppliers/HIT/inventory/filter-values/55414/",
headers={"X-API-Key": "your-api-key"}
)
filters = filter_response.json()["FilterValues"]["Filter"]
# Step 2: User selects "WHITE" color
selected_color = "WHITE"
# Step 3: Query inventory with filter
inventory_response = requests.get(
"https://api.psrestful.com/v2.0.0/suppliers/HIT/inventory/55414/",
params={"color": selected_color},
headers={"X-API-Key": "your-api-key"}
)Use Cases
- Dynamic filter UIs: Build dropdown menus based on available options
- Validation: Ensure filter values are valid before querying
- Product displays: Show available colors/sizes to customers
Related Guides
- Get Inventory Levels - Use filters to query inventory