Recommendations
Get widget recommendations
Retrieves personalized recommendations for a specific widget
POST
/
api
/
widget
/
{widget_id}
Get widget recommendations
curl --request POST \
--url https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id} \
--header 'Content-Type: application/json' \
--data '
{
"current_url": "https://shop.example.com/products/wireless-headphones-pro",
"session_id": "b2b89619844f4eb0b5fa19f28a19d679",
"user_id": "8c80694b-354c-4533-acd1-e4b8e7d74b7b",
"language": "en",
"price_name": "EUR",
"hashid": "de8f052ea612f95b6950d4013dd6ef38",
"cart_items": [
{
"dfid": "123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a"
}
],
"category_context": [
{}
]
}
'import requests
url = "https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}"
payload = {
"current_url": "https://shop.example.com/products/wireless-headphones-pro",
"session_id": "b2b89619844f4eb0b5fa19f28a19d679",
"user_id": "8c80694b-354c-4533-acd1-e4b8e7d74b7b",
"language": "en",
"price_name": "EUR",
"hashid": "de8f052ea612f95b6950d4013dd6ef38",
"cart_items": [{ "dfid": "123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a" }],
"category_context": [{}]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
current_url: 'https://shop.example.com/products/wireless-headphones-pro',
session_id: 'b2b89619844f4eb0b5fa19f28a19d679',
user_id: '8c80694b-354c-4533-acd1-e4b8e7d74b7b',
language: 'en',
price_name: 'EUR',
hashid: 'de8f052ea612f95b6950d4013dd6ef38',
cart_items: [
{
dfid: '123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a'
}
],
category_context: [{}]
})
};
fetch('https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'current_url' => 'https://shop.example.com/products/wireless-headphones-pro',
'session_id' => 'b2b89619844f4eb0b5fa19f28a19d679',
'user_id' => '8c80694b-354c-4533-acd1-e4b8e7d74b7b',
'language' => 'en',
'price_name' => 'EUR',
'hashid' => 'de8f052ea612f95b6950d4013dd6ef38',
'cart_items' => [
[
'dfid' => '123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a'
]
],
'category_context' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}"
payload := strings.NewReader("{\n \"current_url\": \"https://shop.example.com/products/wireless-headphones-pro\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"language\": \"en\",\n \"price_name\": \"EUR\",\n \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"cart_items\": [\n {\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\"\n }\n ],\n \"category_context\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}")
.header("Content-Type", "application/json")
.body("{\n \"current_url\": \"https://shop.example.com/products/wireless-headphones-pro\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"language\": \"en\",\n \"price_name\": \"EUR\",\n \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"cart_items\": [\n {\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\"\n }\n ],\n \"category_context\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"current_url\": \"https://shop.example.com/products/wireless-headphones-pro\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"language\": \"en\",\n \"price_name\": \"EUR\",\n \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"cart_items\": [\n {\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\"\n }\n ],\n \"category_context\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"title": "Our recommendations",
"currency": {
"code": "EUR",
"label": "Euro",
"format": "%v %s",
"symbol": "€",
"precision": 2,
"decimal": ",",
"thousand": "."
},
"fallback_action": "disabled",
"results": [
{}
]
}{
"error": "Bad request",
"details": {
"session_id": [
"length must be less than or equal to 32"
],
"user_id": [
"is required"
],
"current_url": [
"is required"
]
}
}{
"error": "Forbidden origin"
}{
"error": "Not found",
"resource": "Widget",
"resource_id": "cc1e9563-14e4-46f6-bdf3-42bc57083c25"
}{
"error": "Too many request"
}Path Parameters
Unique identifier for the widget
Example:
"123e4567-e89b-12d3-a456-426614174000"
Body
application/json
Current page URL
Example:
"https://shop.example.com/products/wireless-headphones-pro"
Session identifier (optional)
Example:
"b2b89619844f4eb0b5fa19f28a19d679"
User identifier (optional)
Example:
"8c80694b-354c-4533-acd1-e4b8e7d74b7b"
Language code (optional)
Example:
"en"
Currency code (optional)
Example:
"EUR"
Hash identifier (optional)
Example:
"de8f052ea612f95b6950d4013dd6ef38"
A list of items added to the shopping cart for additional context.
Show child attributes
Show child attributes
Contextual category information (optional)
⌘I
Get widget recommendations
curl --request POST \
--url https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id} \
--header 'Content-Type: application/json' \
--data '
{
"current_url": "https://shop.example.com/products/wireless-headphones-pro",
"session_id": "b2b89619844f4eb0b5fa19f28a19d679",
"user_id": "8c80694b-354c-4533-acd1-e4b8e7d74b7b",
"language": "en",
"price_name": "EUR",
"hashid": "de8f052ea612f95b6950d4013dd6ef38",
"cart_items": [
{
"dfid": "123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a"
}
],
"category_context": [
{}
]
}
'import requests
url = "https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}"
payload = {
"current_url": "https://shop.example.com/products/wireless-headphones-pro",
"session_id": "b2b89619844f4eb0b5fa19f28a19d679",
"user_id": "8c80694b-354c-4533-acd1-e4b8e7d74b7b",
"language": "en",
"price_name": "EUR",
"hashid": "de8f052ea612f95b6950d4013dd6ef38",
"cart_items": [{ "dfid": "123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a" }],
"category_context": [{}]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
current_url: 'https://shop.example.com/products/wireless-headphones-pro',
session_id: 'b2b89619844f4eb0b5fa19f28a19d679',
user_id: '8c80694b-354c-4533-acd1-e4b8e7d74b7b',
language: 'en',
price_name: 'EUR',
hashid: 'de8f052ea612f95b6950d4013dd6ef38',
cart_items: [
{
dfid: '123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a'
}
],
category_context: [{}]
})
};
fetch('https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'current_url' => 'https://shop.example.com/products/wireless-headphones-pro',
'session_id' => 'b2b89619844f4eb0b5fa19f28a19d679',
'user_id' => '8c80694b-354c-4533-acd1-e4b8e7d74b7b',
'language' => 'en',
'price_name' => 'EUR',
'hashid' => 'de8f052ea612f95b6950d4013dd6ef38',
'cart_items' => [
[
'dfid' => '123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a'
]
],
'category_context' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}"
payload := strings.NewReader("{\n \"current_url\": \"https://shop.example.com/products/wireless-headphones-pro\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"language\": \"en\",\n \"price_name\": \"EUR\",\n \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"cart_items\": [\n {\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\"\n }\n ],\n \"category_context\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}")
.header("Content-Type", "application/json")
.body("{\n \"current_url\": \"https://shop.example.com/products/wireless-headphones-pro\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"language\": \"en\",\n \"price_name\": \"EUR\",\n \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"cart_items\": [\n {\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\"\n }\n ],\n \"category_context\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"current_url\": \"https://shop.example.com/products/wireless-headphones-pro\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"language\": \"en\",\n \"price_name\": \"EUR\",\n \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"cart_items\": [\n {\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\"\n }\n ],\n \"category_context\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"title": "Our recommendations",
"currency": {
"code": "EUR",
"label": "Euro",
"format": "%v %s",
"symbol": "€",
"precision": 2,
"decimal": ",",
"thousand": "."
},
"fallback_action": "disabled",
"results": [
{}
]
}{
"error": "Bad request",
"details": {
"session_id": [
"length must be less than or equal to 32"
],
"user_id": [
"is required"
],
"current_url": [
"is required"
]
}
}{
"error": "Forbidden origin"
}{
"error": "Not found",
"resource": "Widget",
"resource_id": "cc1e9563-14e4-46f6-bdf3-42bc57083c25"
}{
"error": "Too many request"
}