Recommendations
Register a widget click
Registers a click event on a product recommended by a specific widget
POST
/
api
/
widget
/
{widget_id}
/
click
Register a widget click
curl --request POST \
--url https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}/click \
--header 'Content-Type: application/json' \
--data '
{
"hashid": "de8f052ea612f95b6950d4013dd6ef38",
"dfid": "123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a",
"session_id": "b2b89619844f4eb0b5fa19f28a19d679",
"user_id": "8c80694b-354c-4533-acd1-e4b8e7d74b7b",
"position": 0,
"title": "<string>",
"link": "<string>"
}
'import requests
url = "https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}/click"
payload = {
"hashid": "de8f052ea612f95b6950d4013dd6ef38",
"dfid": "123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a",
"session_id": "b2b89619844f4eb0b5fa19f28a19d679",
"user_id": "8c80694b-354c-4533-acd1-e4b8e7d74b7b",
"position": 0,
"title": "<string>",
"link": "<string>"
}
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({
hashid: 'de8f052ea612f95b6950d4013dd6ef38',
dfid: '123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a',
session_id: 'b2b89619844f4eb0b5fa19f28a19d679',
user_id: '8c80694b-354c-4533-acd1-e4b8e7d74b7b',
position: 0,
title: '<string>',
link: '<string>'
})
};
fetch('https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}/click', 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}/click",
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([
'hashid' => 'de8f052ea612f95b6950d4013dd6ef38',
'dfid' => '123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a',
'session_id' => 'b2b89619844f4eb0b5fa19f28a19d679',
'user_id' => '8c80694b-354c-4533-acd1-e4b8e7d74b7b',
'position' => 0,
'title' => '<string>',
'link' => '<string>'
]),
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}/click"
payload := strings.NewReader("{\n \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"position\": 0,\n \"title\": \"<string>\",\n \"link\": \"<string>\"\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}/click")
.header("Content-Type", "application/json")
.body("{\n \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"position\": 0,\n \"title\": \"<string>\",\n \"link\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}/click")
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 \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"position\": 0,\n \"title\": \"<string>\",\n \"link\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "OK"
}{
"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": "cc1e4567-e89b-12d3-a456-426614174000"
}{
"error": "Too many request"
}Path Parameters
Unique identifier for the widget
Example:
"123e4567-e89b-12d3-a456-426614174000"
Body
application/json
Hash identifier for the search engine
Example:
"de8f052ea612f95b6950d4013dd6ef38"
Doofinder's unique ID for the clicked item
Example:
"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a"
Session identifier for tracking user behavior
Example:
"b2b89619844f4eb0b5fa19f28a19d679"
Unique user identifier
Example:
"8c80694b-354c-4533-acd1-e4b8e7d74b7b"
Position of the item within the recommendation results (optional, default 0)
Example:
0
The product title (optional)
The product link (optional)
Response
Click registered
Example:
"OK"
⌘I
Register a widget click
curl --request POST \
--url https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}/click \
--header 'Content-Type: application/json' \
--data '
{
"hashid": "de8f052ea612f95b6950d4013dd6ef38",
"dfid": "123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a",
"session_id": "b2b89619844f4eb0b5fa19f28a19d679",
"user_id": "8c80694b-354c-4533-acd1-e4b8e7d74b7b",
"position": 0,
"title": "<string>",
"link": "<string>"
}
'import requests
url = "https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}/click"
payload = {
"hashid": "de8f052ea612f95b6950d4013dd6ef38",
"dfid": "123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a",
"session_id": "b2b89619844f4eb0b5fa19f28a19d679",
"user_id": "8c80694b-354c-4533-acd1-e4b8e7d74b7b",
"position": 0,
"title": "<string>",
"link": "<string>"
}
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({
hashid: 'de8f052ea612f95b6950d4013dd6ef38',
dfid: '123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a',
session_id: 'b2b89619844f4eb0b5fa19f28a19d679',
user_id: '8c80694b-354c-4533-acd1-e4b8e7d74b7b',
position: 0,
title: '<string>',
link: '<string>'
})
};
fetch('https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}/click', 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}/click",
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([
'hashid' => 'de8f052ea612f95b6950d4013dd6ef38',
'dfid' => '123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a',
'session_id' => 'b2b89619844f4eb0b5fa19f28a19d679',
'user_id' => '8c80694b-354c-4533-acd1-e4b8e7d74b7b',
'position' => 0,
'title' => '<string>',
'link' => '<string>'
]),
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}/click"
payload := strings.NewReader("{\n \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"position\": 0,\n \"title\": \"<string>\",\n \"link\": \"<string>\"\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}/click")
.header("Content-Type", "application/json")
.body("{\n \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"position\": 0,\n \"title\": \"<string>\",\n \"link\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-recommendations.doofinder.com/api/widget/{widget_id}/click")
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 \"hashid\": \"de8f052ea612f95b6950d4013dd6ef38\",\n \"dfid\": \"123e4567e89b12d3a456426614174000@product@e7b7a6c35b2d4afc94991bfc8100227a\",\n \"session_id\": \"b2b89619844f4eb0b5fa19f28a19d679\",\n \"user_id\": \"8c80694b-354c-4533-acd1-e4b8e7d74b7b\",\n \"position\": 0,\n \"title\": \"<string>\",\n \"link\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "OK"
}{
"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": "cc1e4567-e89b-12d3-a456-426614174000"
}{
"error": "Too many request"
}