Search Query
Request
Method: POST
Endpoint: /v1.4/search
curl --location 'https://<PA_SEARCH_END_POINT>/v1.4/search' \
--header 'accept: application/json' \
--header 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer eyJhbGciOXXXXXXXXXXXXXXXXXXKrF4pA' \
--data {
"customer_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"website_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"q": "Search Term",
"client": "CLIENT_SHORTCODE",
"start": 0,
"scope": {},
"sort_fields": [{ "price": {"order":"asc", "type": "number"}}],
"size": 60
}
Fields
Field | Type | Required | Default | Description |
---|---|---|---|---|
customer_id | String | No (Required only if Personalization is enabled) | Unique identifier for the customer, obtained from the Config API. This identifier persists throughout the customer's lifetime on the platform. For details on retrieving a customer ID, please refer to the Config API documentation. | |
website_id | String | Yes | Client unique website id provided by PA | |
q | String | Yes | Input search query string | |
client | String | Yes | Unique client shortcode provided by PA | |
start | Integer | Yes | Defines the offset from the first result you want to fetch | |
size | Integer | No | 20 | The max number of results you want returned with your query |
sort_fields | Object Array | No | Relevance Score | Sorting search results based on item's numeric and text attributes. Multiple attributes sorting is supported. Sorting of numeric custom attribute are also supported |
Response
{
"type" : 1,
"code" : 0,
"payload": {
"aggregations": {
"price": {
"avg": 6.08374996483326,
"count": 16,
"max": 24.989999771118164,
"min": 2,
"sum": 97.33999943733215
},
"product_category": [
{
"doc_count": 260,
"key": "Category1"
},
{
"doc_count": 14,
"key": "Category2"
}
]
},
"result": [
{
"attributes": {
"brand": "Kansas",
"org_price": 449,
"product_category": "Category1",
"sale_price": 319
},
"availability": -1,
"image_link": "https://www.testlink.com/",
"item_group_id": "250433",
"link": "https://www.testimagelink.com",
"object_types": [
"shelf",
"cupboard",
"filing cabinet",
"cabinetry"
],
"personalized": false,
"product_category_id": 465,
"score": 1,
"sku_id": "12188",
"title": "Sample item",
"website_logo": "https://www.samplelogo.com"
}
],
"total_results": 274,
"suggestions" : {"fuzzy_suggestions" : ["sample_suggestion"]},
"redirects" : {"url": "https://sample_url.com/", "label" : "Sample"}
}
}
Fields
Field | Subfield | Type | Description |
---|---|---|---|
type | Integer | Determines the status of the request; 1 = success and -1 = failed | |
code | Integer | Response code | |
payload | result | Object Array | List of results |
payload | total_results | Integer | Total number of results that match the query |
payload | aggregations | Object | A dictionary containing facet filters information for search input field aggregations where key is the name of the facet filter |
payload | suggestions | Object | Fuzzy Suggestions for the keyword query typed in by the user |
payload | redirects | Object | Redirects for the keyword query configured using Web-app |