The `netsuite-api-client` package provides a robust interface for interacting with NetSuite's SuiteTalk Web Services, specifically focusing on REST calls and SuiteQL queries. It is currently at stable version `1.0.3` and demonstrates an active release cadence with frequent patch updates addressing dependencies and minor fixes. This library distinguishes itself as a direct fork and merge of the formerly popular `netsuite-rest` and `suiteql` packages, specifically designed to address their limitations. Key differentiators include its ESM-only nature, comprehensive TypeScript typings, and the integration of updated dependencies like `got` to mitigate recent CVEs. It is explicitly maintained and supported, offering a more modern and secure alternative for NetSuite integrations. The package supports promise-based operations for standard REST `request` calls and `query` executions, along with a `queryAll` streaming mechanism for efficiently handling large datasets, which is crucial for enterprise-level data operations. Error handling has also been significantly improved to directly surface NetSuite-specific messages.
npm install netsuite-api-clientVerified import paths — ran on the pinned version, not inferred.
Instantiates the NetSuite API client using token-based authentication and performs a basic GET request for customer data, followed by a SuiteQL query.
Refactor `require()` statements to `import` statements. Ensure your `package.json` contains `"type": "module"` or use `.mjs` file extensions for ESM files.
Update your code to access `response.data` instead of `response` directly when handling results from `client.request()` calls.
Access NetSuite specific error details via `err.message` directly. Avoid deeply inspecting properties like `err.response.body` which may contain the less-parsed `got` error.
Verify the field names in your SuiteQL query against NetSuite's schema and ensure the integration role has appropriate permissions. Use `client.request({ path: "record/v1/metadata-catalog/" })` to inspect available resources and fields.Ensure your project is configured for ESM by setting `"type": "module"` in your `package.json` file. Change `const NetsuiteApiClient = require('netsuite-api-client');` to `import { NetsuiteApiClient } from 'netsuite-api-client';`.