NetSuite RESTlet API Specification Template
A RESTlet is only useful if the people calling it know exactly what to send and what comes back. This template documents a custom NetSuite endpoint in a form integration partners can build against: methods, parameters, payloads, authentication and error behavior.
Fill in
NetSuite RESTlet API Specification Template
Work Order Status API (v1.0)
Owner: Integration team Script ID: customscript_wo_status_rl Deployment ID: customdeploy_wo_status_rl Authentication: Token-based authentication Integration role: Integration - Shop Floor
Purpose
Lets the shop floor system read work order status and post completed quantities back to NetSuite.
Endpoints
| Method | Purpose | Request | Success response |
|---|---|---|---|
| GET | Read status | Query parameters below | 200 with JSON body |
| POST | Post completion | JSON body below | 200 with posted record IDs |
| PUT | Not used | ||
| DELETE | Not used |
GET parameters
workOrderId (required, string): NetSuite internal ID or external ID of the work order. includeOperations (optional, boolean, default false).
POST body example
{ "workOrderId": "12345", "completedQuantity": 40, "scrapQuantity": 1, "completedAt": "2026-10-20T14:30:00Z" }
Error responses
400 invalid or missing parameter. 404 work order not found. 409 work order already closed. 500 unexpected error; message includes a correlation ID that matches the script log.
Limits and idempotency
One request completes one operation. Repeating the same request with the same requestId returns the first result and posts nothing new. Keep requests below the account concurrency allowance.
Approvals
Fill in the real RESTlet URL from the script deployment record, since the host and parameters are account specific. Check governance, concurrency and authentication details against NetSuite's current documentation before publishing.
Review your API design
Optional: have an expert review your endpoint contract and error handling.
Optional. The tool and every export work without this. No spam.
How to use the template
Describe the purpose in one or two sentences, then fill in the script and deployment IDs so support can find the code. Document each HTTP method you implement and mark those you do not. Provide a realistic request and response example; consumers copy examples more than they read prose. Export to PDF or Word and send it to the consuming team along with the deployment URL from the script deployment record.
- One section per method actually implemented
- Real example payloads, not placeholders
- State authentication and the role the caller uses
- List every error the caller should handle
Designing the contract
A good RESTlet contract is small and explicit. Validate required parameters, return consistent JSON including on errors, and use meaningful status codes or an error object the caller can parse. Decide whether calls are idempotent. Integrations retry after timeouts, so a POST that creates a record twice on retry will cause real data problems. A request identifier or an external ID lets the script detect repeats safely.
Common mistakes
Common issues are returning an HTML error page instead of JSON, leaking internal error text to the caller, giving the integration role broader permissions than the endpoint needs, and ignoring concurrency limits when several systems call at once. Also remember that RESTlets run with governance limits, so a call that processes an unbounded list will eventually fail. Paginate or move the work to a queue.
- No idempotency on write operations
- Non-JSON error responses
- Over-permissioned integration role
- Unbounded result sets
Frequently Asked Questions
Should I use a RESTlet or the standard REST record API?
Use the standard REST record API or SuiteQL when it already covers the need, since it needs no custom code to maintain. Use a RESTlet when you need custom logic, a combined operation or a tailored payload.
Which authentication should I document?
Document what you actually use, commonly token-based authentication or OAuth 2.0 for integrations, and the specific role. Never put keys or secrets in the specification.
How do I make a POST safe to retry?
Accept a request identifier or use an external ID, check whether it was processed, and return the original result if so. Store the identifier on the record or a custom record.
Does the spec need versioning?
Yes. Put a version in the document and in the deployment or URL parameter, and record changes so consumers know when a field was added or changed.
If you plan to expose NetSuite data to AI agents or other systems through controlled endpoints, Netray can help design and build that layer.
Related Tools
NetSuite Integration Field Mapping Worksheet
Map source system fields to NetSuite fields with transforms, defaults and validation notes, and export the table to Excel for the build team.
NetSuiteNetSuite Integration Throughput Calculator
Estimate how many records per hour an integration can load and how long a migration will take, from call time, concurrency and retries.
NetSuiteSuiteScript Technical Design Document Template
Fill in a technical design document for a SuiteScript customization and export it as PDF or Word for sign-off before you write code.
NetSuiteSuiteScript Code Review Checklist
A practical review checklist for SuiteScript 2.x covering structure, governance, error handling, security and deployment.
More NetSuite tools
See all- NetSuite Saved Search Formula Generator
- NetSuite CSV Import Template Guide
- NetSuite Role Permission Matrix Worksheet
- NetSuite Inventory Costing Method Reference
- NetSuite Month End Close Checklist
- NetSuite License Cost Estimator
- NetSuite User Access Request Form Template
- NetSuite Custom Record Design Spec Template
- NetSuite SuiteScript Deployment Handover Template