nocodb

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

NocoDB CLI

NocoDB CLI

CLI for NocoDB API.
用于NocoDB API的命令行工具。

Plan Requirements

版本要求

FREE PLANS: Base, Table, Field, Record, Link, Attachment APIs, Fiter, Sorts APIs
ENTERPRISE (self-hosted OR cloud-hosted): Workspace, Workspace Collaboration APIs, Base Collaboration APIs, View, Script, Team, API Token APIs
免费版: 支持库、表、字段、记录、关联、附件API,以及筛选、排序API
企业版(自托管或云托管): 支持工作区、工作区协作API,库协作API,视图、脚本、团队、API令牌API

Setup

配置

bash
export NOCODB_TOKEN="your-api-token"
export NOCODB_URL="https://app.nocodb.com"  # optional, this is default
export NOCODB_VERBOSE=1                      # optional, shows resolved IDs
Get your API token: NocoDB → Team & Settings → API Tokens → Add New Token.
bash
export NOCODB_TOKEN="your-api-token"
export NOCODB_URL="https://app.nocodb.com"  # 可选,默认值为该地址
export NOCODB_VERBOSE=1                      # 可选,显示解析后的ID
获取API令牌:进入NocoDB → 团队与设置 → API令牌 → 添加新令牌。

Argument Order

参数顺序

Commands follow a hierarchical pattern. Arguments are always in this order:
WORKSPACE → BASE → TABLE → VIEW/FIELD → RECORD
You can use names (human-readable) or IDs (faster, from NocoDB).
ID Prefixes:
w
=workspace,
p
=base,
m
=table,
c
=column,
vw
=view
Examples:
  • Name:
    nc record:list MyBase Users
  • ID:
    nc record:list pdef5678uvw mghi9012rst
Set
NOCODB_VERBOSE=1
to see resolved IDs:
bash
NOCODB_VERBOSE=1 nc field:list MyBase Users
命令遵循层级结构。参数始终按照以下顺序排列:
工作区 → 库 → 表 → 视图/字段 → 记录
你可以使用名称(易读)或ID(速度更快,来自NocoDB)。
ID前缀:
w
=工作区,
p
=库,
m
=表,
c
=列,
vw
=视图
示例:
  • 名称方式:
    nc record:list MyBase Users
  • ID方式:
    nc record:list pdef5678uvw mghi9012rst
设置
NOCODB_VERBOSE=1
以查看解析后的ID:
bash
NOCODB_VERBOSE=1 nc field:list MyBase Users

→ base: MyBase → pdef5678uvw

→ base: MyBase → pdef5678uvw

→ table: Users → mghi9012rst

→ table: Users → mghi9012rst

undefined
undefined

Quick Reference

快速参考

bash
undefined
bash
undefined

Workspace APIs (Enterprise only)

工作区API(仅企业版可用)

nc workspace:list # → wabc1234xyz
nc workspace:list # → wabc1234xyz

Free plan APIs

免费版API

nc base:list wabc1234xyz # → pdef5678uvw nc table:list pdef5678uvw # → mghi9012rst nc field:list pdef5678uvw mghi9012rst # → cjkl3456opq nc record:list pdef5678uvw mghi9012rst nc record:get pdef5678uvw mghi9012rst 31 nc filter:list pdef5678uvw mghi9012rst vwmno7890abc
nc base:list wabc1234xyz # → pdef5678uvw nc table:list pdef5678uvw # → mghi9012rst nc field:list pdef5678uvw mghi9012rst # → cjkl3456opq nc record:list pdef5678uvw mghi9012rst nc record:get pdef5678uvw mghi9012rst 31 nc filter:list pdef5678uvw mghi9012rst vwmno7890abc

View APIs (Enterprise only: self-hosted or cloud-hosted)

视图API(仅自托管和云托管企业版可用)

nc view:list pdef5678uvw mghi9012rst # → vwmno7890abc
nc view:list pdef5678uvw mghi9012rst # → vwmno7890abc

Filter syntax help

筛选语法帮助

nc where:help
undefined
nc where:help
undefined

Commands

命令

Workspaces

工作区

Note: Workspace APIs and Workspace Collaboration APIs are available only with self-hosted Enterprise plans and cloud-hosted Enterprise plans.
bash
nc workspace:list                         # → wabc1234xyz
nc workspace:get wabc1234xyz
nc workspace:create '{"title":"New Workspace"}'
nc workspace:update wabc1234xyz '{"title":"Renamed"}'
nc workspace:delete wabc1234xyz
nc workspace:members wabc1234xyz
nc workspace:members:add wabc1234xyz '{"email":"user@example.com","roles":"workspace-creator"}'
nc workspace:members:update wabc1234xyz '{"email":"user@example.com","roles":"workspace-viewer"}'
nc workspace:members:remove wabc1234xyz '{"email":"user@example.com"}'
注意: 工作区API和工作区协作API仅在自托管企业版和云托管企业版中可用。
bash
nc workspace:list                         # → wabc1234xyz
nc workspace:get wabc1234xyz
nc workspace:create '{"title":"New Workspace"}'
nc workspace:update wabc1234xyz '{"title":"Renamed"}'
nc workspace:delete wabc1234xyz
nc workspace:members wabc1234xyz
nc workspace:members:add wabc1234xyz '{"email":"user@example.com","roles":"workspace-creator"}'
nc workspace:members:update wabc1234xyz '{"email":"user@example.com","roles":"workspace-viewer"}'
nc workspace:members:remove wabc1234xyz '{"email":"user@example.com"}'

Bases

bash
nc base:list wabc1234xyz                  # → pdef5678uvw
nc base:get pdef5678uvw
nc base:create wabc1234xyz '{"title":"New Base"}'
nc base:update pdef5678uvw '{"title":"Renamed"}'
nc base:delete pdef5678uvw
Base Collaboration (Enterprise plans only)
bash
nc base:members pdef5678uvw
nc base:members:add pdef5678uvw '{"email":"user@example.com","roles":"base-editor"}'
nc base:members:update pdef5678uvw '{"email":"user@example.com","roles":"base-viewer"}'
nc base:members:remove pdef5678uvw '{"email":"user@example.com"}'
bash
nc base:list wabc1234xyz                  # → pdef5678uvw
nc base:get pdef5678uvw
nc base:create wabc1234xyz '{"title":"New Base"}'
nc base:update pdef5678uvw '{"title":"Renamed"}'
nc base:delete pdef5678uvw
库协作(仅企业版可用)
bash
nc base:members pdef5678uvw
nc base:members:add pdef5678uvw '{"email":"user@example.com","roles":"base-editor"}'
nc base:members:update pdef5678uvw '{"email":"user@example.com","roles":"base-viewer"}'
nc base:members:remove pdef5678uvw '{"email":"user@example.com"}'

Tables

bash
nc table:list pdef5678uvw                 # → mghi9012rst
nc table:get pdef5678uvw mghi9012rst
nc table:create pdef5678uvw '{"title":"NewTable"}'
nc table:update pdef5678uvw mghi9012rst '{"title":"Customers"}'
nc table:delete pdef5678uvw mghi9012rst
bash
nc table:list pdef5678uvw                 # → mghi9012rst
nc table:get pdef5678uvw mghi9012rst
nc table:create pdef5678uvw '{"title":"NewTable"}'
nc table:update pdef5678uvw mghi9012rst '{"title":"Customers"}'
nc table:delete pdef5678uvw mghi9012rst

Fields

字段

bash
nc field:list pdef5678uvw mghi9012rst     # → cjkl3456opq
nc field:get pdef5678uvw mghi9012rst cjkl3456opq
nc field:create pdef5678uvw mghi9012rst '{"title":"Phone","type":"PhoneNumber"}'
nc field:update pdef5678uvw mghi9012rst cjkl3456opq '{"title":"Mobile"}'
nc field:delete pdef5678uvw mghi9012rst cjkl3456opq
Field types: SingleLineText, LongText, Number, Decimal, Currency, Percent, Email, URL, PhoneNumber, Date, DateTime, Time, SingleSelect, MultiSelect, Checkbox, Rating, Attachment, Links, User, JSON, etc.
bash
nc field:list pdef5678uvw mghi9012rst     # → cjkl3456opq
nc field:get pdef5678uvw mghi9012rst cjkl3456opq
nc field:create pdef5678uvw mghi9012rst '{"title":"Phone","type":"PhoneNumber"}'
nc field:update pdef5678uvw mghi9012rst cjkl3456opq '{"title":"Mobile"}'
nc field:delete pdef5678uvw mghi9012rst cjkl3456opq
字段类型:SingleLineText、LongText、Number、Decimal、Currency、Percent、Email、URL、PhoneNumber、Date、DateTime、Time、SingleSelect、MultiSelect、Checkbox、Rating、Attachment、Links、User、JSON等。

Views

视图

Note: View APIs are available only on self-hosted and cloud-hosted Enterprise plans.
bash
nc view:list pdef5678uvw mghi9012rst      # → vwmno7890abc
nc view:get pdef5678uvw mghi9012rst vwmno7890abc
nc view:create pdef5678uvw mghi9012rst '{"title":"Active Users","type":"grid"}'
nc view:update pdef5678uvw mghi9012rst vwmno7890abc '{"title":"Renamed"}'
nc view:delete pdef5678uvw mghi9012rst vwmno7890abc
View types: grid, gallery, kanban, calendar
注意: 视图API仅在自托管和云托管企业版中可用。
bash
nc view:list pdef5678uvw mghi9012rst      # → vwmno7890abc
nc view:get pdef5678uvw mghi9012rst vwmno7890abc
nc view:create pdef5678uvw mghi9012rst '{"title":"Active Users","type":"grid"}'
nc view:update pdef5678uvw mghi9012rst vwmno7890abc '{"title":"Renamed"}'
nc view:delete pdef5678uvw mghi9012rst vwmno7890abc
视图类型:grid(网格)、gallery(画廊)、kanban(看板)、calendar(日历)

Records

记录

bash
nc record:list pdef5678uvw mghi9012rst                # page 1, 25 records
nc record:list pdef5678uvw mghi9012rst 2 50           # page 2, 50 records
nc record:list pdef5678uvw mghi9012rst 1 25 "(status,eq,active)"
nc record:list pdef5678uvw mghi9012rst 1 25 "" '[{"field":"cjkl3456opq","direction":"desc"}]'

nc record:get pdef5678uvw mghi9012rst 31
nc record:get pdef5678uvw mghi9012rst 31 "name,email"

nc record:create pdef5678uvw mghi9012rst '{"fields":{"name":"Alice"}}'
nc record:update pdef5678uvw mghi9012rst 31 '{"status":"active"}'
nc record:update-many pdef5678uvw mghi9012rst '[{"id":31,"fields":{"status":"done"}}]'

nc record:delete pdef5678uvw mghi9012rst 31
nc record:delete pdef5678uvw mghi9012rst '[31,32]'

nc record:count pdef5678uvw mghi9012rst
nc record:count pdef5678uvw mghi9012rst "(status,eq,active)"
bash
nc record:list pdef5678uvw mghi9012rst                # 第1页,25条记录
nc record:list pdef5678uvw mghi9012rst 2 50           # 第2页,50条记录
nc record:list pdef5678uvw mghi9012rst 1 25 "(status,eq,active)"
nc record:list pdef5678uvw mghi9012rst 1 25 "" '[{"field":"cjkl3456opq","direction":"desc"}]'

nc record:get pdef5678uvw mghi9012rst 31
nc record:get pdef5678uvw mghi9012rst 31 "name,email"

nc record:create pdef5678uvw mghi9012rst '{"fields":{"name":"Alice"}}'
nc record:update pdef5678uvw mghi9012rst 31 '{"status":"active"}'
nc record:update-many pdef5678uvw mghi9012rst '[{"id":31,"fields":{"status":"done"}}]'

nc record:delete pdef5678uvw mghi9012rst 31
nc record:delete pdef5678uvw mghi9012rst '[31,32]'

nc record:count pdef5678uvw mghi9012rst
nc record:count pdef5678uvw mghi9012rst "(status,eq,active)"

Linked Records

关联记录

bash
nc link:list pdef5678uvw mghi9012rst cjkl3456opq 31
nc link:add pdef5678uvw mghi9012rst cjkl3456opq 31 '[{"id":42}]'
nc link:remove pdef5678uvw mghi9012rst cjkl3456opq 31 '[{"id":42}]'
bash
nc link:list pdef5678uvw mghi9012rst cjkl3456opq 31
nc link:add pdef5678uvw mghi9012rst cjkl3456opq 31 '[{"id":42}]'
nc link:remove pdef5678uvw mghi9012rst cjkl3456opq 31 '[{"id":42}]'

Filters & Sorts (View-level)

筛选与排序(视图级)

bash
nc filter:list pdef5678uvw mghi9012rst vwmno7890abc
nc filter:create pdef5678uvw mghi9012rst vwmno7890abc '{"field_id":"cjkl3456opq","operator":"eq","value":"active"}'
nc sort:list pdef5678uvw mghi9012rst vwmno7890abc
nc sort:create pdef5678uvw mghi9012rst vwmno7890abc '{"field_id":"cjkl3456opq","direction":"desc"}'
bash
nc filter:list pdef5678uvw mghi9012rst vwmno7890abc
nc filter:create pdef5678uvw mghi9012rst vwmno7890abc '{"field_id":"cjkl3456opq","operator":"eq","value":"active"}'
nc sort:list pdef5678uvw mghi9012rst vwmno7890abc
nc sort:create pdef5678uvw mghi9012rst vwmno7890abc '{"field_id":"cjkl3456opq","direction":"desc"}'

Attachments

附件

bash
nc attachment:upload pdef5678uvw mghi9012rst 31 cjkl3456opq ./report.pdf
bash
nc attachment:upload pdef5678uvw mghi9012rst 31 cjkl3456opq ./report.pdf

Scripts

脚本

Note: Script APIs are available only on self-hosted and cloud-hosted Enterprise plans.
bash
nc script:list pdef5678uvw
nc script:create pdef5678uvw '{"title":"My Script"}'
注意: 脚本API仅在自托管和云托管企业版中可用。
bash
nc script:list pdef5678uvw
nc script:create pdef5678uvw '{"title":"My Script"}'

Teams

团队

Note: Team APIs require Enterprise plans (workspace teams are Enterprise-only).
bash
nc team:list wabc1234xyz
nc team:create wabc1234xyz '{"title":"Engineering"}'
注意: 团队API需要企业版(工作区团队功能仅企业版可用)。
bash
nc team:list wabc1234xyz
nc team:create wabc1234xyz '{"title":"Engineering"}'

API Tokens

API令牌

Note: API Token APIs are available only with self-hosted Enterprise plans and cloud-hosted Enterprise plans.
bash
nc token:list
nc token:create '{"title":"CI Token"}'
nc token:delete tkn1a2b3c4d5e6f7g
注意: API令牌API仅在自托管企业版和云托管企业版中可用。
bash
nc token:list
nc token:create '{"title":"CI Token"}'
nc token:delete tkn1a2b3c4d5e6f7g

Where Filter Syntax

筛选器语法

Run
nc where:help
for full documentation.
运行
nc where:help
获取完整文档。

Basic Syntax

基础语法

(field,operator,value)
(field,operator)                    # for null/blank/checked operators
(field,operator,sub_op)             # for date operators
(field,operator,sub_op,value)       # for date with value
(field,operator,value)
(field,operator)                    # 适用于null/空白/已勾选操作符
(field,operator,sub_op)             # 适用于日期操作符
(field,operator,sub_op,value)       # 适用于带值的日期操作

Common Operators

常用操作符

OperatorDescriptionExample
eqEqual
(name,eq,John)
neqNot equal
(status,neq,archived)
likeContains (% wildcard)
(name,like,%john%)
inIn list
(status,in,active,pending)
gt, lt, gte, lteNumeric comparison
(price,gt,100)
blank, notblankNull or empty
(notes,blank)
checked, notcheckedBoolean
(is_active,checked)
操作符描述示例
eq等于
(name,eq,John)
neq不等于
(status,neq,archived)
like包含(%为通配符)
(name,like,%john%)
in在列表中
(status,in,active,pending)
gt, lt, gte, lte数值比较
(price,gt,100)
blank, notblank为空或不为空
(notes,blank)
checked, notchecked布尔值(已勾选/未勾选)
(is_active,checked)

Date Operators

日期操作符

bash
(created_at,eq,today)
(created_at,isWithin,pastWeek)
(created_at,isWithin,pastNumberOfDays,14)
(due_date,lt,today)                          # overdue
(event_date,eq,exactDate,2024-06-15)
bash
(created_at,eq,today)
(created_at,isWithin,pastWeek)
(created_at,isWithin,pastNumberOfDays,14)
(due_date,lt,today)                          # 已逾期
(event_date,eq,exactDate,2024-06-15)

Combining Filters

组合筛选

IMPORTANT: Use
~and
,
~or
,
~not
(with tilde prefix)
bash
(name,eq,John)~and(age,gte,18)
(status,eq,active)~or(status,eq,pending)
~not(is_deleted,checked)
(status,in,active,pending)~and(country,eq,USA)
重要提示: 使用
~and
~or
~not
(带波浪线前缀)
bash
(name,eq,John)~and(age,gte,18)
(status,eq,active)~or(status,eq,pending)
~not(is_deleted,checked)
(status,in,active,pending)~and(country,eq,USA)

Complex Examples

复杂示例

bash
undefined
bash
undefined

Active users created this month

本月创建的活跃用户

"(status,eq,active)~and(created_at,isWithin,pastMonth)"
"(status,eq,active)~and(created_at,isWithin,pastMonth)"

Overdue high-priority tasks

已逾期的高优先级任务

"(due_date,lt,today)~and(priority,eq,high)~and(completed,notchecked)"
"(due_date,lt,today)~and(priority,eq,high)~and(completed,notchecked)"

Orders $100-$500 in pending/processing

金额在100-500之间的待处理/处理中订单

"(amount,gte,100)~and(amount,lte,500)~and(status,in,pending,processing)"
undefined
"(amount,gte,100)~and(amount,lte,500)~and(status,in,pending,processing)"
undefined