Get Recommended Products
1 min
GET
https://api.us1.odp.optimizely.com/v3/recommendations/products
Query Parameters
- {identifier}=identifier_valuestringExamplesEmail Identifier:
{ "email": "[email protected]" }Description - product_idsstringDescription
- typestringDescriptionAllowedpersonalcontextual
- criteriaobjectDescription
- sort_bystringDescription
- orderstringDescriptionDefaultascAllowedascdesc
- limitstringDescriptionDefault10Minimum1Maximum100
Responses
200
- RecommendationExample
[ { "product_id": "1234BLK", "name": "Basics - Black", "brand": "Jungle James Basics", "sku": "1234BLK", "upc": "042100005264", "image_url": "https://http.cat/404", "price": 25.99, "parent_product_id": "1234", "recommendation_type": "contextual" }, { "product_id": "1234BLU", "name": "Basics - Blue", "brand": "Jungle James Basics", "sku": "1234BLU", "upc": "042100005265", "image_url": "https://http.cat/404", "price": 25.99, "parent_product_id": "1234", "recommendation_type": "contextual" } ]- product_idstringExample
- namestringExample
- brandstringExample
- skustringExample
- upcstringExample
- image_urlstringExample
- pricenumberExampleDefault0
- parent_product_idstringExample
- recommendation_typestringExample
400
- undefinedExample
{ "title": "Bad Request", "status": 400, "timestamp": "2018-09-10T21:07:10-05:00", "detail": { "invalids": [ { "field": "delimiter", "reason": "Unrecognized delimiter, valid options are comma, tab or pipe" } ] } }
403
- undefinedExample
{ "message": "Forbidden" }
curl
curl --request GET \
--url 'https://api.us1.odp.optimizely.com/v3/recommendations/products?criteria=object&order=asc&limit=10' \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.us1.odp.optimizely.com/v3/recommendations/products?criteria=object&order=asc&limit=10", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.us1.odp.optimizely.com/v3/recommendations/products?criteria=object&order=asc&limit=10")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.us1.odp.optimizely.com/v3/recommendations/products?criteria=object&order=asc&limit=10"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
200
// OK
{
"product_id": "1234BLK",
"name": "Basics - Black",
"brand": "Jungle James Basics",
"sku": "1234BLK",
"upc": "042100005264",
"image_url": "https://http.cat/404",
"price": 25.99,
"parent_product_id": "1234",
"recommendation_type": "contextual"
}400
// Bad Request
"{\"title\":\"Bad Request\",\"status\":400,\"timestamp\":\"2018-09-10T21:07:10-05:00\",\"detail\":{\"invalids\":[{\"field\":\"delimiter\",\"reason\":\"Unrecognized delimiter, valid options are comma, tab or pipe\"}]}}"403
// Forbidden
"{ \"message\": \"Forbidden\"}"