Search Suggestion API (autocomplete API)
This api is used to fetch the results of query term on the search bar of homepage recursively based on search as you type
Query Parameters
- q stringExample: tel
- types stringExample: allopathy,brand,sku,udp
- per_page integerExample: 11
Header Parameters
- X-Platform undefined[]
Possible values: [
android-13.2.0
,mobileweb-0.0.1
,ios-13.2.0
,desktop-0.0.1
]Example: desktop-0.0.1 - X-Access-Key string
Default value:
1mg_client_access_key
- X-City stringExample: Jamshedpur
Responses
- 200
- 400
OK
Response Headers
Date string
Content-Type string
Transfer-Encoding string
Connection string
Vary string
X-Request-ID string
VISITOR-ID string
X-VISITOR-ID string
Server string
Access-Control-Allow-Methods string
Access-Control-Allow-Headers string
Access-Control-Allow-Origin string
Content-Encoding string
- application/json
- Schema
- Example (from schema)
- Example
Schema
- object
{}
{
"data": {
"term": "tel",
"scroll_id": null,
"previous_scroll_id": null,
"result_found": true,
"search_results": [
{
"id": "88158",
"type": "trending_query",
"name": "<b>Tel</b>ma",
"label": null,
"show_arrow": true,
"image": null,
"url": "/search/all?filter=true&name=Telma",
"search_term": "Telma",
"ad": null
},
{
"id": "88259",
"type": "trending_query",
"name": "<b>Tel</b>ma 40",
"label": null,
"show_arrow": true,
"image": null,
"url": "/search/all?filter=true&name=Telma%2040",
"search_term": "Telma 40",
"ad": null
},
{
"id": "88598",
"type": "trending_query",
"name": "<b>Tel</b>mikind",
"label": null,
"show_arrow": true,
"image": null,
"url": "/search/all?filter=true&name=Telmikind",
"search_term": "Telmikind",
"ad": null
},
{
"type": "labs",
"name": "<b>tel</b>",
"label": "Search in lab tests",
"image": "https://onemg.gumlet.io/marketing/aed560ad-ab01-4811-ab58-82313c7a47a1.png",
"url": "/diagnostic_search?search_term=tel&source=pharma",
"lab_search_suggestions_url": null,
"search_term": "tel",
"show_redirection": true
},
{
"id": "88119",
"type": "trending_query",
"name": "<b>Tel</b>misartan",
"label": null,
"show_arrow": true,
"image": null,
"url": "/search/all?filter=true&name=Telmisartan",
"search_term": "Telmisartan",
"ad": null
},
{
"id": "156665",
"type": "trending_query",
"name": "<b>Tel</b>vas",
"label": null,
"show_arrow": true,
"image": null,
"url": "/search/all?filter=true&name=Telvas",
"search_term": "Telvas",
"ad": null
},
{
"id": "88576",
"type": "trending_query",
"name": "<b>Tel</b>ma h",
"label": null,
"show_arrow": true,
"image": null,
"url": "/search/all?filter=true&name=Telma%20h",
"search_term": "Telma h",
"ad": null
},
{
"id": "89735",
"type": "trending_query",
"name": "<b>Tel</b>ekast",
"label": null,
"show_arrow": true,
"image": null,
"url": "/search/all?filter=true&name=Telekast",
"search_term": "Telekast",
"ad": null
},
{
"id": "210783",
"type": "allopathy",
"name": "<b>Tel</b>misartan",
"label": "Generic drugs (salts)",
"show_arrow": true,
"image": "https://onemg.gumlet.io/marketing/136681b8-87ad-4bf3-815c-acc9c3e51b02.png",
"url": "/generics/telmisartan-210783",
"search_term": "Telmisartan",
"ad": null
},
{
"id": "116043",
"type": "trending_query",
"name": "<b>Tel</b>ekast-l",
"label": null,
"show_arrow": true,
"image": null,
"url": "/search/all?filter=true&name=Telekast-l",
"search_term": "Telekast-l",
"ad": null
},
{
"id": "89031",
"type": "trending_query",
"name": "<b>Tel</b>ma 20",
"label": null,
"show_arrow": true,
"image": null,
"url": "/search/all?filter=true&name=Telma%2020",
"search_term": "Telma 20",
"ad": null
},
{
"id": "140596",
"type": "trending_query",
"name": "<b>Tel</b>mikind-h",
"label": null,
"show_arrow": true,
"image": null,
"url": "/search/all?filter=true&name=Telmikind-h",
"search_term": "Telmikind-h",
"ad": null
}
],
"search_suggestions": null,
"user_funnel": {
"shingle_active": true,
"query_suggestion_found": false,
"trending_query_found": true,
"score_weights": "1-1-10",
"contains_tag": "not_eligible",
"is_static": false,
"layout": "not_eligible",
"apply_raw_search": false,
"secondary_applicable": true,
"suggestions_ab_control": "Control Set1",
"google_suggestion_present": null,
"type": "with_full_suggestions",
"pla_present": false
}
},
"partial_complete": false,
"is_success": true,
"status_code": 200
}
Bad Request
Response Headers
Date string
Content-Type string
Content-Length integer
Connection string
X-Request-ID string
VISITOR-ID string
X-VISITOR-ID string
Server string
Access-Control-Allow-Methods string
Access-Control-Allow-Headers string
Access-Control-Allow-Origin string
- application/json
- Schema
- Example (from schema)
- example-0
- example-1
Schema
- object
{}
Bad Request / City Header is Required
{
"is_success": false,
"status_code": 400,
"error": {
"message": "City is required",
"errors": [
{
"message": "City is required"
}
]
}
}
Bad Request / Header Missing
{
"is_success": false,
"status_code": 400,
"error": {
"message": "Invalid request",
"errors": [
{
"message": "Invalid request"
}
]
}
}
Loading...