cURL
curl --request GET \
--url https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data \
--header 'API-Access-Key: <api-key>'import requests
url = "https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data"
headers = {"API-Access-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'API-Access-Key': '<api-key>'}};
fetch('https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data', 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://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"API-Access-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("API-Access-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data")
.header("API-Access-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["API-Access-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id_item_set": 123,
"crm_data": {
"customer_id": "CUST_001",
"customer_name": "CUST_NAME",
"contact_person": "Иван Иванов",
"phone": "+7-999-123-45-67",
"email": "ivan@example.com"
},
"created_at": "2024-01-15T10:30:00Z"
}Запросы
Получение CRM данных по ID item_set
Получение CRM данных, связанных с указанным item_set
GET
/
client
/
item-set
/
{item_set_id}
/
crm-data
cURL
curl --request GET \
--url https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data \
--header 'API-Access-Key: <api-key>'import requests
url = "https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data"
headers = {"API-Access-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'API-Access-Key': '<api-key>'}};
fetch('https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data', 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://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"API-Access-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("API-Access-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data")
.header("API-Access-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spellit.ai/api/client/item-set/{item_set_id}/crm-data")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["API-Access-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id_item_set": 123,
"crm_data": {
"customer_id": "CUST_001",
"customer_name": "CUST_NAME",
"contact_person": "Иван Иванов",
"phone": "+7-999-123-45-67",
"email": "ivan@example.com"
},
"created_at": "2024-01-15T10:30:00Z"
}Возвращает CRM данные, связанные с указанным item_set.
Параметры
item_set_id(int, path, обязательный) - ID item_set
Примеры запросов
Пример 1: Базовый запрос CRM данных
curl -X GET "https://api.spellit.ai/api/client/item-set/123/crm-data" \
-H "API-Access-Key: your access key"
Пример 2: Запрос с дополнительными заголовками
curl -X GET "https://api.spellit.ai/api/client/item-set/123/crm-data" \
-H "API-Access-Key: your access key" \
-H "Accept: application/json" \
-H "Content-Type: application/json"
Возможные ошибки
401 Unauthorized- Отсутствует или неверный токен аутентификации403 Forbidden- Item_set не принадлежит текущему пользователю404 Not Found- Item_set с указанным ID не найден500 Internal Server Error- Внутренняя ошибка сервера
Описание полей ответа
id_item_set- ID item_set, для которого запрашивались CRM данныеcrm_data- объект с CRM данными илиnull, если данные отсутствуют- Структура CRM данных зависит от настроек клиента
- Может содержать любые поля, переданные при создании item_set
created_at- дата и время создания метаданных с CRM данными илиnull
Примечания
- CRM данные извлекаются из
processing_parameters.extra_processing_data.crm_data - Если CRM данные не были переданы при создании item_set, поле
crm_dataбудетnull - CRM данные могут быть любыми JSON объектами, структура определяется клиентом
Дополнительные примеры использования
Примеры обработки ошибок:
Ошибка аутентификации:
# Запрос без токена
curl -X GET "https://api.spellit.ai/api/client/item-set/123/crm-data"
# Ответ:
# HTTP/1.1 401 Unauthorized
{
"detail": "Not authenticated"
}
Authorizations
ApiKeyAuthBearerAuth
API-ключ для доступа к эндпоинтам
Path Parameters
ID item_set
⌘I