Create
Creates a new index for a search engine.
curl --request POST \
--url https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "product",
"preset": "product",
"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"
payload = {
"name": "product",
"preset": "product",
"options": {},
"datasources": [
{
"type": "file",
"options": { "url": "https://yourserver/your_data_feed.xml" }
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'product',
preset: 'product',
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', 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",
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([
'name' => 'product',
'preset' => 'product',
'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"
payload := strings.NewReader("{\n \"name\": \"product\",\n \"preset\": \"product\",\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("POST", 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.post("https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"product\",\n \"preset\": \"product\",\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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"product\",\n \"preset\": \"product\",\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": "index_exists",
"message": "Index already exists"
}
}{
"error": {
"code": "too_many_requests",
"message": "Too many requests"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error"
}
}Authorizations
Doofinder API key. Pass it as: Authorization: Token <api_key>
Path Parameters
Unique id of a search engine.
^[a-f0-9]{32}$Body
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.
^[a-z][a-z0-9_]*$"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.
generic, product, page, category "product"
Accepted for backwards compatibility but ignored.
List of datasources of an index.
Show child attributes
Show child attributes
Response
Index created.
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.
^[a-z][a-z0-9_]*$"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.
generic, product, page, category "product"
Accepted for backwards compatibility but ignored.
List of datasources of an index.
Show child attributes
Show child attributes
curl --request POST \
--url https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "product",
"preset": "product",
"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"
payload = {
"name": "product",
"preset": "product",
"options": {},
"datasources": [
{
"type": "file",
"options": { "url": "https://yourserver/your_data_feed.xml" }
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'product',
preset: 'product',
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', 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",
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([
'name' => 'product',
'preset' => 'product',
'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"
payload := strings.NewReader("{\n \"name\": \"product\",\n \"preset\": \"product\",\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("POST", 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.post("https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"product\",\n \"preset\": \"product\",\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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"product\",\n \"preset\": \"product\",\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": "index_exists",
"message": "Index already exists"
}
}{
"error": {
"code": "too_many_requests",
"message": "Too many requests"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error"
}
}