ns-metadata-cli
v1.0.1
Published
CLI for fetching record metadata from NetSuite
Downloads
307
Readme
NetSuite Metadata CLI
A command line tool for fetching record metadata from NetSuite using the REST metadata catalog API.
Companion to suiteql-cli and works the same way: multiple nicknamed accounts, browser-based OAuth 2.0 login, and the most recently used account is remembered automatically.
Installation
npm install -g ns-metadata-cliThis adds a new nsmeta command to your PATH.
nsmeta -helpUsage
Run without a record type to list every record type available in the account, or pass one or more record types with -r to get their field metadata.
You can manually choose an account with -a, or the tool will automatically remember which account was used most recently. Account names can be anything you would like.
Metadata can be output as a field table (default), CSV (-csv), the raw JSON Schema (-json), or an OpenAPI 3.0 document (-openapi).
Authentication into NetSuite is accomplished in the browser via OAuth 2.0. You must have the OAuth 2.0 feature enabled in your account under Setup -> Company -> Enable Features -> SuiteCloud. Your role must also have the following permissions:
- Setup -> REST Web Services
- Setup -> Log in using OAuth 2.0 Access Tokens
Examples
List all record types in an account:
nsmeta -a productionView the fields of a record type as a table:
nsmeta -a production -r salesorderWrite the fields of a record type, with descriptions, to a CSV file:
nsmeta -r salesorder -desc -csv > salesorder-fields.csvSave the raw JSON Schema of a record type:
nsmeta -r salesorder -json > salesorder-schema.jsonGenerate an OpenAPI 3.0 document for several record types:
nsmeta -r customer,salesorder,invoice -openapi > netsuite-api.jsonArguments
| Flag | Definition | | -------- | ------------------------------------------------------------------------------------------------ | | -help | View a full list of arguments | | -a | Account nickname to fetch metadata from. If none is provided, the last used account will be used | | -r | Record type(s) to fetch metadata for. Multiple types can be comma-separated | | -desc | Includes field descriptions in the field table (truncated in table output; full text in CSV) | | -csv | Outputs the field table or record type list as CSV. Default output is a table | | -json | Outputs the raw JSON Schema (or the record type list) as JSON. Default output is a table | | -openapi | Outputs an OpenAPI 3.0 document for the record type(s) | | -list | Lists all accounts and their expiration status | | -reset | Removes all account authentication data. |
Development
npm install
npm run build
node dist/index.js -help