通过 v3 REST API 访问和管理 NocoDB 数据库,支持管理工作区、基础、表、字段、视图、记录等,具备筛选、排序等功能。
NocoDB CLI.是一项面向实际任务的技能,主要用于CLI for NocoDB API..Platform 支持.Linux/ macOS :脚本/noc是一项面向实际任务的技能,主要用于Plan Requireds.;FREE Plans: Base, Table, Field, Record, Link, 附件 API, Fi;
若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。
该技能适合用于一次性任务,也可以接入自动化工作流,与其他技能或上层代理配合完成更完整的业务链路;在组合使用时,应明确每一步的输入输出关系,并避免不同步骤之间出现参数冲突。结果生成后应检查内容的完整性、准确性、一致性和可用性,必要时抽样复核并根据反馈调整配置;涉及外部服务、账号凭据、个人信息或敏感数据时,还需遵守相应的权限、安全与合规要求。
NocoDB API 的命令行工具(CLI)。
scripts/nocodb.sh(Bash 脚本,需安装 curl 和 jq)免费套餐(FREE PLANS): Base、Table、Field、Record、Link、Attachment 相关 API,以及 Filter、Sorts 相关 API
企业版(ENTERPRISE,自托管或云托管): Workspace、Workspace Collaboration、Base Collaboration、View、Script、Team、API Token 相关 API
export NOCODB_TOKEN="your-api-token" export NOCODB_URL="https://app.nocodb.com" # 可选,默认值 export NOCODB_VERBOSE=1 # 可选,显示解析后的 ID
获取 API token 方法:NocoDB → Team & Settings → API Tokens → Add New Token。
命令遵循层级化结构。参数始终按以下顺序指定:
WORKSPACE → BASE → TABLE → VIEW/FIELD → RECORD
可使用 名称(人类可读)或 ID(速度更快,来自 NocoDB)。
ID 前缀说明: w=workspace,p=base,m=table,c=column,vw=view
示例:
nc record:list MyBase Usersnc record:list pdef5678uvw mghi9012rst设置 NOCODB_VERBOSE=1 可查看解析后的 ID:
NOCODB_VERBOSE=1 nc field:list MyBase Users # → base: MyBase → pdef5678uvw # → table: Users → mghi9012rst
# Workspace 相关 API(仅限企业版) nc workspace:list # → wabc1234xyz # 免费套餐支持的 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 # View 相关 API(仅限企业版:自托管或云托管) nc view:list pdef5678uvw mghi9012rst # → vwmno7890abc # Filter 语法帮助 nc where:help
注意: Workspace API 和 Workspace Collaboration API 仅在自托管 Enterprise 套餐及云托管 Enterprise 套餐中可用。
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"}'
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(仅限企业版套餐)
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"}'
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
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 等。
注意: View API 仅在自托管和云托管 Enterprise 套餐中可用。
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 类型包括:grid、gallery、kanban、calendar
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)"
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}]'
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"}'
nc attachment:upload pdef5678uvw mghi9012rst 31 cjkl3456opq ./report.pdf
注意: Script API 仅在自托管和云托管 Enterprise 套餐中可用。
nc script:list pdef5678uvw
nc script:create pdef5678uvw '{"title":"My Script"}'
注意: Team API 需要 Enterprise 套餐(workspace teams 为 Enterprise 专属功能)。
nc team:list wabc1234xyz
nc team:create wabc1234xyz '{"title":"Engineering"}'
注意: API Token API 仅在自托管 Enterprise 套餐及云托管 Enterprise 套餐中可用。
nc token:list
nc token:create '{"title":"CI Token"}'
nc token:delete tkn1a2b3c4d5e6f7g
运行 nc where:help 查看完整文档。
(field,operator,value) (field,operator) # 用于 null/blank/checked 类操作符 (field,operator,sub_op) # 用于日期类操作符 (field,operator,sub_op,value) # 用于带值的日期类操作符
| 操作符 | 说明 | 示例 |
|---|---|---|
| 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) |
(created_at,eq,today) (created_at,isWithin,pastWeek) (created_at,isWithin,pastNumberOfDays,14) (due_date,lt,today) # 已逾期 (event_date,eq,exactDate,2024-06-15)
重要: 使用 ~and、~or、~not(必须带波浪线前缀)
(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)
# 本月创建的活跃用户 "(status,eq,active)~and(created_at,isWithin,pastMonth)" # 已逾期且高优先级的任务 "(due_date,lt,today)~and(priority,eq,high)~and(completed,notchecked)" # 金额在 $100–$500 之间且状态为 pending/processing 的订单 "(amount,gte,100)~and(amount,lte,500)~and(status,in,pending,processing)"
相关专题
热门下载
相关下载
精品课程
共6课时 | 54.7万人学习
共89课时 | 134.3万人学习
共49课时 | 82.7万人学习
最新文章