1. Choose the Right REST API
NetSuite offers two REST options, each with specific use cases:
- SuiteTalk REST Web Services:
- Provides standardized REST API endpoints.
- Ideal for CRUD operations on standard NetSuite records.
- RESTlets:
- Customizable scripts for specific business logic.
- Use when you need flexibility beyond standard CRUD operations.
2. Enable Required Features
Make sure the following features are enabled in Setup > Company > Enable Features:
- SuiteTalk REST Web Services (for SuiteTalk REST).
- Token-Based Authentication (TBA) for secure access.
- Web Services or RESTlets as applicable.
3. Use Token-Based Authentication (TBA)
- TBA is more secure and efficient than basic authentication.
- Generate Tokens:
- Create an Integration Record (Setup > Integration > Manage Integrations) and enable TBA.
- Assign tokens to roles with the least required permissions.
- Pass tokens in the Authorization header:
http Copy code Authorization: NLAuth nlauth_account=123456, nlauth_consumer_key=abc, nlauth_token=xyz
4. Handle Rate Limits
- NetSuite enforces API governance limits for both REST APIs:
- Daily request limits (based on account type).
- Concurrency limits for simultaneous requests.
- Optimize calls by:
- Minimizing API calls through batch operations.
- Using search operations to retrieve bulk data.
5. Use Pagination for Large Data Sets
For SuiteTalk REST, use the next and offset properties in the response metadata to paginate results.
Example of a paginated call:
http Copy code GET https://<account_id>.suitetalk.api.netsuite.com/v1/someRecord?page=2&limit=50