json icon

Search Products

v1.0.0queries

Query to search the catalog for products matching a term, with optional filters and pagination.

1{
2  "$schema": "http://json-schema.org/draft-07/schema#",
3  "title": "SearchProducts",
4  "description": "Query to search the catalog for products, and the paginated result returned",
5  "type": "object",
6  "properties": {
7    "request": {
8      "description": "Search parameters",
9      "type": "object",
10      "properties": {
11        "query": {
12          "description": "Free-text search term",
13          "type": "string",
14          "minLength": 1
15        },
16        "filters": {
17          "description": "Optional filters applied to the search",
18          "type": "object",
19          "properties": {
20            "category": {
21              "type": "string"
22            },
23            "status": {
24              "type": "string",
25              "enum": ["DRAFT", "ACTIVE", "ARCHIVED"]
26            },
27            "minPrice": {
28              "description": "Minimum price in minor units (e.g. cents)",
29              "type": "integer",
30              "minimum": 0
31            },
32            "maxPrice": {
33              "description": "Maximum price in minor units (e.g. cents)",
34              "type": "integer",
35              "minimum": 0
36            }
37          }
38        },
39        "page": {
40          "description": "1-based page number",
41          "type": "integer",
42          "minimum": 1,
43          "default": 1
44        },
45        "pageSize": {
46          "description": "Number of results per page",
47          "type": "integer",
48          "minimum": 1,
49          "maximum": 100,
50          "default": 20
51        }
52      },
53      "required": ["query"]
54    },
55    "response": {
56      "description": "Paginated search results",
57      "type": "object",
58      "properties": {
59        "total": {
60          "description": "Total number of products matching the query",
61          "type": "integer"
62        },
63        "page": {
64          "type": "integer"
65        },
66        "pageSize": {
67          "type": "integer"
68        },
69        "results": {
70          "type": "array",
71          "items": {
72            "type": "object",
73            "properties": {
74              "productId": {
75                "type": "string",
76                "format": "uuid"
77              },
78              "sku": {
79                "type": "string"
80              },
81              "name": {
82                "type": "string"
83              },
84              "category": {
85                "type": "string"
86              },
87              "price": {
88                "description": "Price in minor units (e.g. cents)",
89                "type": "integer"
90              },
91              "currency": {
92                "type": "string",
93                "pattern": "^[A-Z]{3}$"
94              },
95              "score": {
96                "description": "Relevance score for this result",
97                "type": "number"
98              }
99            },
100            "required": ["productId", "sku", "name"]
101          }
102        }
103      },
104      "required": ["total", "page", "pageSize", "results"]
105    }
106  },
107  "required": ["request", "response"]
108}
109

Details

Format
JSON Schema
Resource
queries
Filename
schema.json

Versions