Session & Events
Click stats
Save click event on doofinder statistics
PUT
/
6
/
{hashid}
/
stats
/
click
Click stats
curl --request PUT \
--url https://{search_zone}-search.doofinder.com/6/{hashid}/stats/click \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"dfid": "<unknown>",
"session_id": "<string>",
"custom_results_id": "<string>",
"user_id": "<string>",
"query": "<string>",
"position": 123,
"resource_id": "<string>"
}
'import requests
url = "https://{search_zone}-search.doofinder.com/6/{hashid}/stats/click"
payload = {
"dfid": "<unknown>",
"session_id": "<string>",
"custom_results_id": "<string>",
"user_id": "<string>",
"query": "<string>",
"position": 123,
"resource_id": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
dfid: '<unknown>',
session_id: '<string>',
custom_results_id: '<string>',
user_id: '<string>',
query: '<string>',
position: 123,
resource_id: '<string>'
})
};
fetch('https://{search_zone}-search.doofinder.com/6/{hashid}/stats/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}-search.doofinder.com/6/{hashid}/stats/click",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'dfid' => '<unknown>',
'session_id' => '<string>',
'custom_results_id' => '<string>',
'user_id' => '<string>',
'query' => '<string>',
'position' => 123,
'resource_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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}-search.doofinder.com/6/{hashid}/stats/click"
payload := strings.NewReader("{\n \"dfid\": \"<unknown>\",\n \"session_id\": \"<string>\",\n \"custom_results_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"query\": \"<string>\",\n \"position\": 123,\n \"resource_id\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://{search_zone}-search.doofinder.com/6/{hashid}/stats/click")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"dfid\": \"<unknown>\",\n \"session_id\": \"<string>\",\n \"custom_results_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"query\": \"<string>\",\n \"position\": 123,\n \"resource_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-search.doofinder.com/6/{hashid}/stats/click")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dfid\": \"<unknown>\",\n \"session_id\": \"<string>\",\n \"custom_results_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"query\": \"<string>\",\n \"position\": 123,\n \"resource_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "registered"
}Authorizations
Doofinder API key. Pass it as: Authorization: Token <api_key>
Path Parameters
Unique id of a search engine.
Body
application/json
Identifier of search session
Maximum string length:
32Identifier of the custom result the search results belongs to.
Identifier of user
Maximum string length:
36The search query that led to this
The position the clicked item have in the search results. The first position should be 1.
Identifier of the resource that generated the click
Response
OK
Response returned over register stat operation.
Result of the stats request. i.e. 'registered'
⌘I
Click stats
curl --request PUT \
--url https://{search_zone}-search.doofinder.com/6/{hashid}/stats/click \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"dfid": "<unknown>",
"session_id": "<string>",
"custom_results_id": "<string>",
"user_id": "<string>",
"query": "<string>",
"position": 123,
"resource_id": "<string>"
}
'import requests
url = "https://{search_zone}-search.doofinder.com/6/{hashid}/stats/click"
payload = {
"dfid": "<unknown>",
"session_id": "<string>",
"custom_results_id": "<string>",
"user_id": "<string>",
"query": "<string>",
"position": 123,
"resource_id": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
dfid: '<unknown>',
session_id: '<string>',
custom_results_id: '<string>',
user_id: '<string>',
query: '<string>',
position: 123,
resource_id: '<string>'
})
};
fetch('https://{search_zone}-search.doofinder.com/6/{hashid}/stats/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}-search.doofinder.com/6/{hashid}/stats/click",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'dfid' => '<unknown>',
'session_id' => '<string>',
'custom_results_id' => '<string>',
'user_id' => '<string>',
'query' => '<string>',
'position' => 123,
'resource_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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}-search.doofinder.com/6/{hashid}/stats/click"
payload := strings.NewReader("{\n \"dfid\": \"<unknown>\",\n \"session_id\": \"<string>\",\n \"custom_results_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"query\": \"<string>\",\n \"position\": 123,\n \"resource_id\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://{search_zone}-search.doofinder.com/6/{hashid}/stats/click")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"dfid\": \"<unknown>\",\n \"session_id\": \"<string>\",\n \"custom_results_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"query\": \"<string>\",\n \"position\": 123,\n \"resource_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-search.doofinder.com/6/{hashid}/stats/click")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dfid\": \"<unknown>\",\n \"session_id\": \"<string>\",\n \"custom_results_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"query\": \"<string>\",\n \"position\": 123,\n \"resource_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "registered"
}