Search API - RoyalGr4pe/stockx-sdk GitHub Wiki
search(params: dict)
๐ฆ Performs a product search using the StockX Catalog API. This allows you to find products by keyword, with optional pagination.
๐ง Function Signature
search(params: dict) -> dict
๐งพ Parameters
Name | Type | Description | Default |
---|---|---|---|
query |
str | Search term (e.g., product name, style code, SKU). | โ |
pageNumber |
int | Page number of the results to fetch. | 1 |
pageSize |
int | Number of results to return per page. | 1 |
โน๏ธ All parameters are optional, but
query
is generally required for useful results.
โ Returns
A dictionary containing:
count
(int): Number of products returned on this page.hasNextPage
(bool): Whether more pages of results are available.pageNumber
(int): Current page number.pageSize
(int): Number of results per page.products
(list): List of product objects.
Each product includes fields like:
{
"brand": "Nike",
"productId": "c07b2c5e-7a20-42c8-99ed-bfff0202e97c",
"styleId": "CU9225-001",
"title": "Nike Air Force 1 Low Supreme Black",
"urlKey": "nike-air-force-1-low-supreme-box-logo-black",
"productType": "sneakers",
"productAttributes": {
"color": null,
"colorway": "Black/Black-Black",
"gender": "men",
"releaseDate": "2020-03-05",
"retailPrice": null,
"season": null
}
}
๐ก Example
results = await search({
"query": "Nike Tech Fleece",
"pageNumber": 1,
"pageSize": 4
})
for product in results["products"]:
print(product["title"], "-", product["styleId"])
๐ซ Errors
Raises an exception if:
- The API request fails (e.g., invalid token, network error)
- Required authentication headers are missing (ensure
setup()
was called)