Přejít na hlavní obsah
PUT
/
v1
/
schemas
/
{schema_id}
const updated = await client.schemas.update("schema_abc123", {
  name: "Updated Electronics Schema",
  columns: [
    { key: "product_name", label: "Product Name", type: "text", required: true },
    { key: "price", label: "Price (USD)", type: "number" },
    { key: "brand", label: "Brand", type: "text" },
    { key: "weight_kg", label: "Weight (kg)", type: "number" },
  ],
});
updated = client.schemas.update(
    "schema_abc123",
    name="Updated Electronics Schema",
    columns=[
        {"key": "product_name", "label": "Product Name", "type": "text", "required": True},
        {"key": "price", "label": "Price (USD)", "type": "number"},
        {"key": "brand", "label": "Brand", "type": "text"},
        {"key": "weight_kg", "label": "Weight (kg)", "type": "number"},
    ],
)
curl -X PUT "https://hub.banditshq.com/api/v1/schemas/schema_abc123" \
  -H "Authorization: Bearer lasso_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Electronics Schema",
    "columns": [
      {"key": "product_name", "label": "Product Name", "type": "text", "required": true},
      {"key": "price", "label": "Price (USD)", "type": "number"},
      {"key": "brand", "label": "Brand", "type": "text"},
      {"key": "weight_kg", "label": "Weight (kg)", "type": "number"}
    ]
  }'
{
  "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"
}

Parametry cesty

schema_id
string
povinné
Jedinečný identifikátor schématu.

Tělo požadavku

Všechna pole jsou volitelná. Aktualizují se pouze zadaná pole.
name
string
Nový název schématu.
description
string
Nový popis.
is_default
boolean
Zda by toto mělo být výchozí schéma.
columns
array
Aktualizované definice sloupců. Nahradí celý seznam sloupců. Musí být neprázdné pole s platnými objekty sloupců.

Odpověď

Vrací úplný aktualizovaný objekt schématu (stejný tvar jako Získat schéma).
const updated = await client.schemas.update("schema_abc123", {
  name: "Updated Electronics Schema",
  columns: [
    { key: "product_name", label: "Product Name", type: "text", required: true },
    { key: "price", label: "Price (USD)", type: "number" },
    { key: "brand", label: "Brand", type: "text" },
    { key: "weight_kg", label: "Weight (kg)", type: "number" },
  ],
});
updated = client.schemas.update(
    "schema_abc123",
    name="Updated Electronics Schema",
    columns=[
        {"key": "product_name", "label": "Product Name", "type": "text", "required": True},
        {"key": "price", "label": "Price (USD)", "type": "number"},
        {"key": "brand", "label": "Brand", "type": "text"},
        {"key": "weight_kg", "label": "Weight (kg)", "type": "number"},
    ],
)
curl -X PUT "https://hub.banditshq.com/api/v1/schemas/schema_abc123" \
  -H "Authorization: Bearer lasso_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Electronics Schema",
    "columns": [
      {"key": "product_name", "label": "Product Name", "type": "text", "required": true},
      {"key": "price", "label": "Price (USD)", "type": "number"},
      {"key": "brand", "label": "Brand", "type": "text"},
      {"key": "weight_kg", "label": "Weight (kg)", "type": "number"}
    ]
  }'
{
  "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"
}
Aktualizace sloupců nahradí celou definici sloupců. Zahrňte všechny sloupce, které chcete zachovat, ne pouze změny.