Example request
cURL
JavaScript
PHP
Python
Ruby
Go
curl -X POST https://api.skryx.io/v1/indexes/products/suggest \
-H "Authorization: Bearer $SKRYX_API_KEY" \
-H "Content-Type: application/json" \
-d '
{
"q": "son",
"suggest_by": "title,brand",
"per_page": 5
}
'
const response = await fetch('https://api.skryx.io/v1/indexes/products/suggest', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SKRYX_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
q: 'son',
suggest_by: 'title,brand',
per_page: 5,
}),
});
const data = await response.json();
<?php
$ch = curl_init('https://api.skryx.io/v1/indexes/products/suggest');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SKRYX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'q' => 'son',
'suggest_by' => 'title,brand',
'per_page' => 5,
]),
]);
$response = json_decode(curl_exec($ch), true);
import os
import requests
response = requests.post(
'https://api.skryx.io/v1/indexes/products/suggest',
headers={
'Authorization': f"Bearer {os.environ['SKRYX_API_KEY']}",
'Content-Type': 'application/json',
},
json={
'q': 'son',
'suggest_by': 'title,brand',
'per_page': 5,
},
)
data = response.json()
require 'net/http'
require 'json'
uri = URI('https://api.skryx.io/v1/indexes/products/suggest')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri, {
'Authorization' => "Bearer #{ENV['SKRYX_API_KEY']}",
'Content-Type' => 'application/json',
})
request.body = {
'q' => 'son',
'suggest_by' => 'title,brand',
'per_page' => 5,
}.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{}{
"q": 'son',
"suggest_by": 'title,brand',
"per_page": 5,
})
req, _ := http.NewRequest("POST", "https://api.skryx.io/v1/indexes/products/suggest", 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
}