본문으로 건너뛰기

데이터베이스 API (테이블 관리)

테이블 생성/조회/수정/삭제와 컬럼 관리 엔드포인트입니다. 모든 엔드포인트는 X-Public-Key 인증이 필요합니다.

테이블 목록 조회

GET /v1/public/tables

bash
curl -X GET "https://api.connectbase.world/v1/public/tables" \
  -H "X-Public-Key: cb_pk_your_public_key"

응답: { "tables": Table[] } 형태입니다.

json
{
  "tables": [
    {
      "id": "tbl_users",
      "app_id": "app_xxx",
      "title": "users",
      "schema": {
        "email": { "type": "string", "required": true },
        "name":  "string"
      },
      "is_active": true,
      "access_level": "Creator",
      "create_time": "2026-04-09T00:00:00Z",
      "update_time": "2026-04-09T00:00:00Z"
    }
  ]
}

📌 Table 객체는 Ent ORM 의 raw 응답이라 타임스탬프 필드명이 create_time / update_time 입니다 (data row 응답의 created_at / updated_at 와 다릅니다). 컬럼은 별도 배열이 아니라 schema 객체 안에 컬럼명을 키로 가진 맵입니다. 옵션이 없는 컬럼은 "name": "string" 처럼 평탄한 문자열로 저장되고, required / default / description / encrypted 같은 옵션이 하나라도 있으면 { "type": "string", "required": true, ... } 처럼 객체로 저장됩니다. 컬럼 정의 객체의 키는 type / required / default / description / encrypted (snake_case 가 아닙니다). order 는 컬럼 추가 순서대로 자동 부여되며, 응답을 GET /v1/public/tables/:tableID/columns 로 받을 때만 별도 order 필드가 채워집니다.

단일 테이블 조회

GET /v1/public/tables/:tableID

bash
curl -X GET "https://api.connectbase.world/v1/public/tables/tbl_xxx" \
  -H "X-Public-Key: cb_pk_your_public_key"

응답: 단일 Table 객체. (id, app_id, title, schema, is_active, access_level, create_time, update_time)

테이블 생성

POST /v1/public/tables

bash
curl -X POST "https://api.connectbase.world/v1/public/tables" \
  -H "X-Public-Key: cb_pk_your_public_key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "products",
    "access_level": "Creator",
    "schema": {
      "name":  { "type": "string", "required": true },
      "price": { "type": "number", "required": true }
    }
  }'
필드타입필수설명
titlestring테이블 이름
schemaobject컬럼명 → 컬럼 정의 맵
access_levelstringCreator / Public / AppMember (PascalCase)

schema 의 각 컬럼 정의 객체에서 사용 가능한 키:

  • type: string / number / boolean / date / object / array / uuid / int
  • required (boolean, 선택)
  • default (any, 선택)
  • description (string, 선택)
  • encrypted (boolean, 선택, AES-256-GCM)

옵션이 하나도 없으면 "name": "string" 처럼 문자열로 단축 표기할 수 있습니다.

응답:

json
{ "message": "테이블이 생성되었습니다" }

테이블 수정

PATCH /v1/public/tables/:tableID

PUT 시맨틱으로 동작합니다 — title, schema, access_level 모두 필수입니다.

bash
curl -X PATCH "https://api.connectbase.world/v1/public/tables/tbl_xxx" \
  -H "X-Public-Key: cb_pk_your_public_key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "products",
    "access_level": "Creator",
    "schema": {
      "name":  { "type": "string", "required": true },
      "price": { "type": "number", "required": true }
    }
  }'

응답:

json
{ "message": "테이블이 수정되었습니다" }

테이블 삭제

DELETE /v1/public/tables/:tableID

bash
curl -X DELETE "https://api.connectbase.world/v1/public/tables/tbl_xxx" \
  -H "X-Public-Key: cb_pk_your_public_key"

응답: { "message": "테이블이 삭제되었습니다" }

컬럼 추가

POST /v1/public/tables/:tableID/columns

bash
curl -X POST "https://api.connectbase.world/v1/public/tables/tbl_xxx/columns" \
  -H "X-Public-Key: cb_pk_your_public_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "price",
    "data_type": "number",
    "is_required": true
  }'
필드타입필수설명
namestring컬럼 이름
data_typestringstring / int / number / bool / uuid / date / object / array (※ bool 이며 boolean 아님)
is_requiredboolean필수 여부 (기본 false)
default_valueany기본값 (타입에 맞는 모든 값 허용)
descriptionstring설명
encryptedboolean필드 레벨 암호화 (AES-256-GCM)

⚠️ order 필드는 컬럼 추가 시 자동 부여되며 클라이언트가 보낼 수 없습니다.

응답: { "message": "컬럼이 추가되었습니다" }

컬럼 수정

PATCH /v1/public/tables/:tableID/columns/:columnName

본문 필드는 모두 선택입니다 (data_type, is_required, default_value, description, encrypted).

컬럼 삭제

DELETE /v1/public/tables/:tableID/columns/:columnName