Thanks to visit codestin.com
Credit goes to docs.nocobase.com

nb api resource update

Update records in a selected resource. Use --filter-by-tk or --filter to locate records, and pass update content through --values.

Usage

nb api resource update --resource <resource> --values <json> [flags]

Parameters

ParameterTypeDescription
--resourcestringResource name, required
--data-sourcestringData source key, default main
--source-idstringSource record ID for association resources
--filter-by-tkstringPrimary key value; composite or multiple keys can be passed as a JSON array
--filterstringFilter conditions as a JSON object
--valuesstringUpdate data as a JSON object, required
--whiteliststring[]Fields allowed to write; repeatable or pass a JSON array
--blackliststring[]Fields forbidden to write; repeatable or pass a JSON array
--update-association-valuesstring[]Association fields to update at the same time; repeatable or pass a JSON array
--force-update / --no-force-updatebooleanWhether to force writing unchanged values

Also supports common connection parameters from nb api resource.

Examples

nb api resource update --resource users --filter-by-tk 1 --values '{"nickname":"Grace"}'
nb api resource update --resource posts --filter '{"status":"draft"}' --values '{"status":"published"}'