Indices
Update
Updates a search engine index.
PATCH
/
api
/
v2
/
search_engines
/
{hashid}
/
indices
/
{name}
Update
curl --request PATCH \
--url https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"options": {},
"datasources": [
{
"type": "file",
"options": {
"url": "https://yourserver/your_data_feed.xml"
}
}
]
}
'import requests
url = "https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}"
payload = {
"options": {},
"datasources": [
{
"type": "file",
"options": { "url": "https://yourserver/your_data_feed.xml" }
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
options: {},
datasources: [{type: 'file', options: {url: 'https://yourserver/your_data_feed.xml'}}]
})
};
fetch('https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}', 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}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'options' => [
],
'datasources' => [
[
'type' => 'file',
'options' => [
'url' => 'https://yourserver/your_data_feed.xml'
]
]
]
]),
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}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}"
payload := strings.NewReader("{\n \"options\": {},\n \"datasources\": [\n {\n \"type\": \"file\",\n \"options\": {\n \"url\": \"https://yourserver/your_data_feed.xml\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"options\": {},\n \"datasources\": [\n {\n \"type\": \"file\",\n \"options\": {\n \"url\": \"https://yourserver/your_data_feed.xml\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"options\": {},\n \"datasources\": [\n {\n \"type\": \"file\",\n \"options\": {\n \"url\": \"https://yourserver/your_data_feed.xml\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "product",
"preset": "product",
"options": {},
"datasources": [
{
"type": "file",
"options": {
"url": "https://yourserver/your_data_feed.xml"
}
}
]
}{
"error": {
"code": "bad_params",
"message": "Bad parameters error",
"details": [
{
"name": "language",
"fields": [
"language"
],
"reason": "is invalid"
}
]
}
}{
"error": {
"code": "not_authenticated",
"message": "Authentication required"
}
}{
"error": {
"code": "access_denied",
"message": "Access denied"
}
}{
"error": {
"code": "not_found",
"message": "Not found"
}
}{
"error": {
"code": "searchengine_timeout",
"message": "Timeout connecting to backend"
}
}{
"error": {
"code": "searchengine_locked",
"message": "Search engine is being processed"
}
}{
"error": {
"code": "too_many_requests",
"message": "Too many requests"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error"
}
}Authorizations
api_tokenjwt_token
Doofinder API key. Pass it as: Authorization: Token <api_key>
Path Parameters
Unique id of a search engine.
Pattern:
^[a-f0-9]{32}$Name of an index.
Pattern:
^[a-z][a-z0-9_]*$Body
application/json
Response
Index was updated.
Set of options and parameters of an index. They define the way an index is built.
Name of the Index. It works as the index identifier.
Pattern:
^[a-z][a-z0-9_]*$Example:
"product"
Preset of the index. The preset defines a set of configuration parameters for the index like basic fields to be included, and field transformations. For instance, the product preset creates the best_price field.
Available options:
generic, product, page, category Example:
"product"
Accepted for backwards compatibility but ignored.
List of datasources of an index.
Show child attributes
Show child attributes
⌘I
Update
curl --request PATCH \
--url https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"options": {},
"datasources": [
{
"type": "file",
"options": {
"url": "https://yourserver/your_data_feed.xml"
}
}
]
}
'import requests
url = "https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}"
payload = {
"options": {},
"datasources": [
{
"type": "file",
"options": { "url": "https://yourserver/your_data_feed.xml" }
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
options: {},
datasources: [{type: 'file', options: {url: 'https://yourserver/your_data_feed.xml'}}]
})
};
fetch('https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}', 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}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'options' => [
],
'datasources' => [
[
'type' => 'file',
'options' => [
'url' => 'https://yourserver/your_data_feed.xml'
]
]
]
]),
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}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}"
payload := strings.NewReader("{\n \"options\": {},\n \"datasources\": [\n {\n \"type\": \"file\",\n \"options\": {\n \"url\": \"https://yourserver/your_data_feed.xml\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"options\": {},\n \"datasources\": [\n {\n \"type\": \"file\",\n \"options\": {\n \"url\": \"https://yourserver/your_data_feed.xml\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"options\": {},\n \"datasources\": [\n {\n \"type\": \"file\",\n \"options\": {\n \"url\": \"https://yourserver/your_data_feed.xml\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "product",
"preset": "product",
"options": {},
"datasources": [
{
"type": "file",
"options": {
"url": "https://yourserver/your_data_feed.xml"
}
}
]
}{
"error": {
"code": "bad_params",
"message": "Bad parameters error",
"details": [
{
"name": "language",
"fields": [
"language"
],
"reason": "is invalid"
}
]
}
}{
"error": {
"code": "not_authenticated",
"message": "Authentication required"
}
}{
"error": {
"code": "access_denied",
"message": "Access denied"
}
}{
"error": {
"code": "not_found",
"message": "Not found"
}
}{
"error": {
"code": "searchengine_timeout",
"message": "Timeout connecting to backend"
}
}{
"error": {
"code": "searchengine_locked",
"message": "Search engine is being processed"
}
}{
"error": {
"code": "too_many_requests",
"message": "Too many requests"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error"
}
}