cURL
curl --request GET \
--url https://api.spellit.ai/api/client/project/{project_id}/item-sets \
--header 'API-Access-Key: <api-key>'import requests
url = "https://api.spellit.ai/api/client/project/{project_id}/item-sets"
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/project/{project_id}/item-sets', 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/project/{project_id}/item-sets",
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/project/{project_id}/item-sets"
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/project/{project_id}/item-sets")
.header("API-Access-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spellit.ai/api/client/project/{project_id}/item-sets")
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{
"item_sets": [
{
"id": 123,
"name": "item_set_name_abc123",
"created_at": "2024-01-15T10:30:00Z",
"status": "processed",
"status_within_project": "processed"
}
],
"total_count": 1
}{
"detail": "Unauthorized"
}{
"detail": "Forbidden"
}{
"detail": "Project not found"
}{
"detail": "Internal server error"
}Запросы
Получение списка item_set по ID проекта
Получение списка всех item_set для указанного проекта
GET
/
client
/
project
/
{project_id}
/
item-sets
cURL
curl --request GET \
--url https://api.spellit.ai/api/client/project/{project_id}/item-sets \
--header 'API-Access-Key: <api-key>'import requests
url = "https://api.spellit.ai/api/client/project/{project_id}/item-sets"
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/project/{project_id}/item-sets', 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/project/{project_id}/item-sets",
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/project/{project_id}/item-sets"
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/project/{project_id}/item-sets")
.header("API-Access-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spellit.ai/api/client/project/{project_id}/item-sets")
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{
"item_sets": [
{
"id": 123,
"name": "item_set_name_abc123",
"created_at": "2024-01-15T10:30:00Z",
"status": "processed",
"status_within_project": "processed"
}
],
"total_count": 1
}{
"detail": "Unauthorized"
}{
"detail": "Forbidden"
}{
"detail": "Project not found"
}{
"detail": "Internal server error"
}Возвращает список всех item_set для указанного проекта.
Параметры
project_id(int, path, обязательный) - ID проектаpage(int, query, опциональный) - Номер страницы для пагинацииper_page(int, query, опциональный) - Количество элементов на страницеstatus_filter(string, query, опциональный) - Фильтр по статусу item_set
Примеры запросов
Пример 1: Базовый запрос
curl -X GET "https://api.spellit.ai/api/client/project/123/item-sets" \
-H "API-Access-Key: your access key"
Пример 2: С пагинацией
curl -X GET "https://api.spellit.ai/api/client/project/123/item-sets?page=2&per_page=10" \
-H "API-Access-Key: your access key"
Пример 3: С фильтром по статусу
curl -X GET "https://api.spellit.ai/api/client/project/123/item-sets?status_filter=processed" \
-H "API-Access-Key: your access key"
Возможные ошибки
401 Unauthorized- Отсутствует или неверный токен аутентификации403 Forbidden- Проект не принадлежит текущему пользователю404 Not Found- Проект с указанным ID не найден500 Internal Server Error- Внутренняя ошибка сервера
Описание полей ответа
item_sets- массив объектов item_setid- уникальный идентификатор item_setname- название item_set (содержит UUID для уникальности)created_at- дата и время создания (ISO 8601)status- статус обработки item_set (added, processing, processed, processing_failed)status_within_project- статус item_set в рамках проекта (added, all_items_processed, processing, processed, processing_failed)
total_count- общее количество найденных item_set
Статусы и их значения
Статусы item_set:
added- добавлен, ожидает обработкиprocessing- в процессе обработкиprocessed- успешно обработанprocessing_failed- ошибка обработки
Статусы item_set в рамках проекта:
added- добавлен в проектall_items_processed- все элементы обработаныprocessing- в процессе обработкиprocessed- полностью обработанprocessing_failed- ошибка обработки
Дополнительные примеры использования
Примеры обработки ошибок:
Ошибка аутентификации:
# Запрос без токена
curl -X GET "https://api.spellit.ai/api/client/project/123/item-sets"
# Ответ:
# HTTP/1.1 401 Unauthorized
{
"detail": "Not authenticated"
}
Ошибка доступа к проекту:
# Запрос к проекту, к которому нет доступа
curl -X GET "https://api.spellit.ai/api/client/project/999/item-sets" \
-H "API-Access-Key: your access key"
# Ответ:
# HTTP/1.1 403 Forbidden
{
"detail": "Project not found or access denied"
}
Authorizations
ApiKeyAuthBearerAuth
API-ключ для доступа к эндпоинтам
Path Parameters
ID проекта
Query Parameters
Номер страницы для пагинации
Количество элементов на странице
Фильтр по статусу item_set
Available options:
added, processing, processed, processing_failed ⌘I