Schémata
Vytvořit schéma
Vytvoření nového produktového schématu s definicemi sloupců.
POST
/
v1
/
schemas
const schema = await client.schemas.create({
name: "Electronics Catalog",
description: "Schema for consumer electronics",
columns: [
{ key: "product_name", label: "Product Name", type: "text", required: true },
{ key: "price", label: "Price", type: "number" },
{ key: "brand", label: "Brand", type: "text" },
{ key: "category", label: "Category", type: "enum", enum_values: ["phones", "laptops", "tablets"] },
{ key: "image_url", label: "Image", type: "image" },
{ key: "specs", label: "Specifications", type: "json" },
],
});
console.log(schema.id);
schema = client.schemas.create(
name="Electronics Catalog",
description="Schema for consumer electronics",
columns=[
{"key": "product_name", "label": "Product Name", "type": "text", "required": True},
{"key": "price", "label": "Price", "type": "number"},
{"key": "brand", "label": "Brand", "type": "text"},
{"key": "category", "label": "Category", "type": "enum", "enum_values": ["phones", "laptops", "tablets"]},
{"key": "image_url", "label": "Image", "type": "image"},
{"key": "specs", "label": "Specifications", "type": "json"},
],
)
print(schema["id"])
curl -X POST "https://hub.banditshq.com/api/v1/schemas" \
-H "Authorization: Bearer lasso_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Electronics Catalog",
"description": "Schema for consumer electronics",
"columns": [
{"key": "product_name", "label": "Product Name", "type": "text", "required": true},
{"key": "price", "label": "Price", "type": "number"},
{"key": "brand", "label": "Brand", "type": "text"},
{"key": "category", "label": "Category", "type": "enum", "enum_values": ["phones", "laptops", "tablets"]},
{"key": "image_url", "label": "Image", "type": "image"},
{"key": "specs", "label": "Specifications", "type": "json"}
]
}'
{
"id": "schema_abc123",
"name": "Electronics Catalog",
"description": "Schema for consumer electronics",
"is_default": false,
"columns": [
{ "key": "product_name", "label": "Product Name", "type": "text", "required": true },
{ "key": "price", "label": "Price", "type": "number" }
],
"created_at": "2025-03-01T10:00:00.000Z",
"updated_at": "2025-03-01T10:00:00.000Z"
}
Tělo požadavku
string
povinné
Název schématu.
string
Popis, k čemu se toto schéma používá.
boolean
výchozí:"false"
Zda by toto mělo být výchozí schéma.
array
povinné
Pole definic sloupců. Nesmí být prázdné.
Zobrazit Objekt sloupce
Zobrazit Objekt sloupce
string
povinné
Strojově čitelný klíč (snake_case).
string
povinné
Lidsky čitelný popisek.
string
povinné
Typ sloupce. Jeden z:
text, number, url, email, date, boolean, richtext, enum, tags, image, images, json.boolean
Zda je tento sloupec povinný.
string
Popis sloupce.
string[]
Povolené hodnoty pro sloupce typu
enum.Odpověď
string
Jedinečný identifikátor schématu.
string
Název schématu.
string | null
Popis schématu.
boolean
Zda je toto výchozí schéma.
array
Definice sloupců.
string
Časové razítko ISO 8601.
string
Časové razítko ISO 8601.
const schema = await client.schemas.create({
name: "Electronics Catalog",
description: "Schema for consumer electronics",
columns: [
{ key: "product_name", label: "Product Name", type: "text", required: true },
{ key: "price", label: "Price", type: "number" },
{ key: "brand", label: "Brand", type: "text" },
{ key: "category", label: "Category", type: "enum", enum_values: ["phones", "laptops", "tablets"] },
{ key: "image_url", label: "Image", type: "image" },
{ key: "specs", label: "Specifications", type: "json" },
],
});
console.log(schema.id);
schema = client.schemas.create(
name="Electronics Catalog",
description="Schema for consumer electronics",
columns=[
{"key": "product_name", "label": "Product Name", "type": "text", "required": True},
{"key": "price", "label": "Price", "type": "number"},
{"key": "brand", "label": "Brand", "type": "text"},
{"key": "category", "label": "Category", "type": "enum", "enum_values": ["phones", "laptops", "tablets"]},
{"key": "image_url", "label": "Image", "type": "image"},
{"key": "specs", "label": "Specifications", "type": "json"},
],
)
print(schema["id"])
curl -X POST "https://hub.banditshq.com/api/v1/schemas" \
-H "Authorization: Bearer lasso_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Electronics Catalog",
"description": "Schema for consumer electronics",
"columns": [
{"key": "product_name", "label": "Product Name", "type": "text", "required": true},
{"key": "price", "label": "Price", "type": "number"},
{"key": "brand", "label": "Brand", "type": "text"},
{"key": "category", "label": "Category", "type": "enum", "enum_values": ["phones", "laptops", "tablets"]},
{"key": "image_url", "label": "Image", "type": "image"},
{"key": "specs", "label": "Specifications", "type": "json"}
]
}'
{
"id": "schema_abc123",
"name": "Electronics Catalog",
"description": "Schema for consumer electronics",
"is_default": false,
"columns": [
{ "key": "product_name", "label": "Product Name", "type": "text", "required": true },
{ "key": "price", "label": "Price", "type": "number" }
],
"created_at": "2025-03-01T10:00:00.000Z",
"updated_at": "2025-03-01T10:00:00.000Z"
}
Typy sloupců
| Typ | Popis |
|---|---|
text | Prostý textový řetězec. |
number | Číselná hodnota (celé číslo nebo desetinné číslo). |
url | Platná URL adresa. |
email | E-mailová adresa. |
date | Řetězec s datem nebo datem a časem. |
boolean | true nebo false. |
richtext | Text formátovaný v HTML nebo markdownu. |
enum | Jedna z předdefinované sady hodnot (viz enum_values). |
tags | Pole textových štítků. |
image | Jedna URL adresa obrázku. |
images | Pole URL adres obrázků. |
json | Libovolný JSON objekt. |
⌘I
const schema = await client.schemas.create({
name: "Electronics Catalog",
description: "Schema for consumer electronics",
columns: [
{ key: "product_name", label: "Product Name", type: "text", required: true },
{ key: "price", label: "Price", type: "number" },
{ key: "brand", label: "Brand", type: "text" },
{ key: "category", label: "Category", type: "enum", enum_values: ["phones", "laptops", "tablets"] },
{ key: "image_url", label: "Image", type: "image" },
{ key: "specs", label: "Specifications", type: "json" },
],
});
console.log(schema.id);
schema = client.schemas.create(
name="Electronics Catalog",
description="Schema for consumer electronics",
columns=[
{"key": "product_name", "label": "Product Name", "type": "text", "required": True},
{"key": "price", "label": "Price", "type": "number"},
{"key": "brand", "label": "Brand", "type": "text"},
{"key": "category", "label": "Category", "type": "enum", "enum_values": ["phones", "laptops", "tablets"]},
{"key": "image_url", "label": "Image", "type": "image"},
{"key": "specs", "label": "Specifications", "type": "json"},
],
)
print(schema["id"])
curl -X POST "https://hub.banditshq.com/api/v1/schemas" \
-H "Authorization: Bearer lasso_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Electronics Catalog",
"description": "Schema for consumer electronics",
"columns": [
{"key": "product_name", "label": "Product Name", "type": "text", "required": true},
{"key": "price", "label": "Price", "type": "number"},
{"key": "brand", "label": "Brand", "type": "text"},
{"key": "category", "label": "Category", "type": "enum", "enum_values": ["phones", "laptops", "tablets"]},
{"key": "image_url", "label": "Image", "type": "image"},
{"key": "specs", "label": "Specifications", "type": "json"}
]
}'
{
"id": "schema_abc123",
"name": "Electronics Catalog",
"description": "Schema for consumer electronics",
"is_default": false,
"columns": [
{ "key": "product_name", "label": "Product Name", "type": "text", "required": true },
{ "key": "price", "label": "Price", "type": "number" }
],
"created_at": "2025-03-01T10:00:00.000Z",
"updated_at": "2025-03-01T10:00:00.000Z"
}

