nb api resource

Run generic CRUD and aggregate queries against any NocoBase resource. The resource can be a normal resource such as users, or an association resource such as posts.comments.

Usage

nb api resource <command>

Subcommands

CommandDescription
nb api resource listList resource records
nb api resource getGet one resource record
nb api resource createCreate a resource record
nb api resource updateUpdate resource records
nb api resource destroyDelete resource records
nb api resource queryRun aggregate queries

Common Parameters

ParameterTypeDescription
--api-base-urlstringNocoBase API URL, for example http://localhost:13000/api
--verbosebooleanShow detailed progress
--env, -estringEnv name
--rolestringRole override sent as the X-Role request header
--token, -tstringAPI key override
--json-output, -j / --no-json-outputbooleanWhether to output raw JSON; enabled by default
--resourcestringResource name, required, for example users, orders, or posts.comments
--data-sourcestringData source key, default main

Association resource commands can also use --source-id to specify the source record ID.

Examples

nb api resource list --resource users
nb api resource get --resource users --filter-by-tk 1
nb api resource create --resource users --values '{"nickname":"Ada"}'
nb api resource list --resource posts.comments --source-id 1 --fields id --fields content