The context request object
Use a context object to specify the types of context you want to retrieve in the response. You can add different <context_types> in your request, such as information about the user, browser, geographic location, store, fitment, page, campaign, and channel to make results more relevant.
The following shows the basic structure of a context object in a request:
{
"context": {
"<context_type>": {
"<context_key>": {<context_key_values>}
}
}
}Key
The following table describes the keys that the context object contains:
|
Key |
Type |
Description |
Values |
|---|---|---|---|
|
|
Optional. Contains the supported context object type. You can have more than one |
| |
|
|
array |
Optional. Contains the You can have more than one |
n/a |
Context type objects
The following table describes the supported context objects:
|
Object |
Type |
Description |
|---|---|---|
|
|
User details including IDs, gender, email address, and group. | |
|
|
User device or browser information. | |
|
|
User location including geographic information and IP address. | |
|
|
Store ID associated with the user. | |
|
|
User fitment information. | |
|
|
Page details including URL, title, IDs, list of products, and locale information. | |
|
|
Campaign information including | |
|
|
Channel information. |
Example
In this example, you apply a user context for gender:
}
{
"query": {
"keyphrase": [["red", "shorts"]]
},
"n_item": 3,,
"content": {},
"context": {
"user": {
"gender": "female"
}
}