Rank products for the shopper
/v1/shoppers/me/rankPuts any list of your products in the shopper's order: your list's own order, moved by their taste as far as the profile has learnt it (a profile with a dozen reactions moves it most). Use it on a category page or your own search results. Up to 500 ids are read; without a token, or with nothing learnt, the order is yours unchanged.
Headers
1The shopper's profile token, from auth/start, auth/verify or any call that made a profile. Optional here.
Request body
application/jsonrequiredYour products, in your order. Duplicates are read once; only the first 500 are ranked.
Response
The product.
How well it fits their taste, about −1 to 1. 0 when nothing is learnt.
Why it moved, when it moved for a reason worth saying ("Fits your black, relaxed tees."). Null otherwise.
Errors
23Every error is JSON with a single error string unless noted. Match on the status code; the message is for humans.
Request body must be valid JSON.A body was sent and could not be parsed as JSON.
Request body must be a JSON object.A body was sent and parsed to something other than a JSON object.
That shopper token is not valid here. Start a profile or sign in again.X-Shopper-Token was sent but cannot be opened with this key.
itemIds must be a non-empty array.itemIds is missing, not an array, or empty.
curl -X POST "https://stylor.ai/api/v1/shoppers/me/rank" \
-H "Authorization: Bearer $STYLOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"itemIds": [
"701e5cee-41da-4e91-a688-69e8c8dd5fe3",
"a342cbe3-965b-4055-8ac3-20f63103cade",
"35a725c8-23fb-4009-a52a-2a778d2e504a"
]
}'{
"items": [
{
"itemId": "35a725c8-23fb-4009-a52a-2a778d2e504a",
"score": 0.38,
"reason": "Fits your dark, slim, jeans."
},
{
"itemId": "701e5cee-41da-4e91-a688-69e8c8dd5fe3",
"score": 0.05,
"reason": null
},
{
"itemId": "a342cbe3-965b-4055-8ac3-20f63103cade",
"score": -0.12,
"reason": null
}
]
}