nb api resource create

Create records in a selected resource. Pass record data as a JSON object through --values, or as a JSON array of objects to create multiple records in a single request.

Usage

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

Parameters

ParameterTypeDescription
--resourcestringResource name, required
--data-sourcestringData source key, default main
--source-idstringSource record ID for association resources
--valuesstringData for the new records: a JSON object, or a JSON array of objects to create multiple records; required
--whiteliststring[]Fields allowed to write; repeatable or pass a JSON array
--blackliststring[]Fields forbidden to write; repeatable or pass a JSON array

Also supports common connection parameters from nb api resource.

Examples

nb api resource create --resource users --values '{"nickname":"Ada"}'
nb api resource create --resource users --values '[{"nickname":"Ada"},{"nickname":"Grace"}]'
nb api resource create --resource posts.comments --source-id 1 --values '{"content":"Hello"}'