Example request
curl -X PATCH https://api.skryx.io/v1/indexes/products/settings \
-H "Authorization: Bearer $SKRYX_API_KEY" \
-H "Content-Type: application/json" \
-d '
{
"typo_config": {
"num_typos": 2,
"min_word_length_for_1_typo": 4
},
"search_attributes": [
{
"field": "title",
"mode": "ordered",
"weight": 5
},
{
"field": "brand",
"mode": "ordered",
"weight": 3
},
{
"field": "category",
"mode": "unordered",
"weight": 1
}
],
"relevance": {
"prefix_bonus": 10,
"sku_bonus": 20,
"brand_bonus": 5
},
"stop_words": [
"the",
"a",
"an"
]
}
'
const response = await fetch('https://api.skryx.io/v1/indexes/products/settings', {
method: 'PATCH',
headers: {
'Authorization': `Bearer ${process.env.SKRYX_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
typo_config: {
num_typos: 2,
min_word_length_for_1_typo: 4,
},
search_attributes: [
{
field: 'title',
mode: 'ordered',
weight: 5,
},
{
field: 'brand',
mode: 'ordered',
weight: 3,
},
{
field: 'category',
mode: 'unordered',
weight: 1,
}
],
relevance: {
prefix_bonus: 10,
sku_bonus: 20,
brand_bonus: 5,
},
stop_words: [
'the',
'a',
'an'
],
}),
});
const data = await response.json();
<?php
$ch = curl_init('https://api.skryx.io/v1/indexes/products/settings');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SKRYX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'typo_config' => [
'num_typos' => 2,
'min_word_length_for_1_typo' => 4,
],
'search_attributes' => [
0 => [
'field' => 'title',
'mode' => 'ordered',
'weight' => 5,
],
1 => [
'field' => 'brand',
'mode' => 'ordered',
'weight' => 3,
],
2 => [
'field' => 'category',
'mode' => 'unordered',
'weight' => 1,
],
],
'relevance' => [
'prefix_bonus' => 10,
'sku_bonus' => 20,
'brand_bonus' => 5,
],
'stop_words' => [
0 => 'the',
1 => 'a',
2 => 'an',
],
]),
]);
$response = json_decode(curl_exec($ch), true);
import os
import requests
response = requests.patch(
'https://api.skryx.io/v1/indexes/products/settings',
headers={
'Authorization': f"Bearer {os.environ['SKRYX_API_KEY']}",
'Content-Type': 'application/json',
},
json={
'typo_config': {
'num_typos': 2,
'min_word_length_for_1_typo': 4,
},
'search_attributes': [
{
'field': 'title',
'mode': 'ordered',
'weight': 5,
},
{
'field': 'brand',
'mode': 'ordered',
'weight': 3,
},
{
'field': 'category',
'mode': 'unordered',
'weight': 1,
}
],
'relevance': {
'prefix_bonus': 10,
'sku_bonus': 20,
'brand_bonus': 5,
},
'stop_words': [
'the',
'a',
'an'
],
},
)
data = response.json()
require 'net/http'
require 'json'
uri = URI('https://api.skryx.io/v1/indexes/products/settings')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(uri.request_uri, {
'Authorization' => "Bearer #{ENV['SKRYX_API_KEY']}",
'Content-Type' => 'application/json',
})
request.body = {
'typo_config' => {
'num_typos' => 2,
'min_word_length_for_1_typo' => 4,
},
'search_attributes' => {
0 => {
'field' => 'title',
'mode' => 'ordered',
'weight' => 5,
},
1 => {
'field' => 'brand',
'mode' => 'ordered',
'weight' => 3,
},
2 => {
'field' => 'category',
'mode' => 'unordered',
'weight' => 1,
},
},
'relevance' => {
'prefix_bonus' => 10,
'sku_bonus' => 20,
'brand_bonus' => 5,
},
'stop_words' => {
0 => 'the',
1 => 'a',
2 => 'an',
},
}.to_json
response = JSON.parse(http.request(request).body)
package main
import (
"bytes"
"encoding/json"
"io"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]interface{}{
"typo_config": map[string]interface{}{
"num_typos": 2,
"min_word_length_for_1_typo": 4,
},
"search_attributes": map[string]interface{}{
"0": map[string]interface{}{
"field": 'title',
"mode": 'ordered',
"weight": 5,
},
"1": map[string]interface{}{
"field": 'brand',
"mode": 'ordered',
"weight": 3,
},
"2": map[string]interface{}{
"field": 'category',
"mode": 'unordered',
"weight": 1,
},
},
"relevance": map[string]interface{}{
"prefix_bonus": 10,
"sku_bonus": 20,
"brand_bonus": 5,
},
"stop_words": map[string]interface{}{
"0": 'the',
"1": 'a',
"2": 'an',
},
})
req, _ := http.NewRequest("PATCH", "https://api.skryx.io/v1/indexes/products/settings", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("SKRYX_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
response, _ := io.ReadAll(resp.Body)
_ = response
}