Skip to main content

Search Query

Request

Method: POST

Endpoint: /v1.4/search

curl --location 'https://<SEARCH_DOMAIN>/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

FieldTypeRequiredDefaultDescription
customer_idStringYesRandom unique customer id generate by PA tracker
website_idStringYesClient unique website id provided by PA
qStringYesInput search query string
clientStringYesUnique client shortcode provided by PA
startIntegerYesDefines the offset from the first result you want to fetch
sizeIntegerNo20The max number of results you want returned with your query
sort_fieldsObject ArrayNoRelevance ScoreSorting 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

FieldSubfieldTypeDescription
typeIntegerDetermines the status of the request; 1 = success and -1 = failed
codeIntegerResponse code
payloadresultObject ArrayList of results
payloadtotal_resultsIntegerTotal number of results that match the query
payloadaggregationsObjectA dictionary containing facet filters information for search input field aggregations where key is the name of the facet filter
payloadsuggestionsObjectFuzzy Suggestions for the keyword query typed in by the user
payloadredirectsObjectRedirects for the keyword query configured using Web-app