Using the Upsert Operation
The upsert operation enables you to either create a record, or update an existing record. You can only use the upsert operation when you use an external ID in the request URL and when you use the PUT HTTP method. For information about using external IDs, see Using External IDs.
You can use the upsert operation as a synchronization tool. When using the upsert operation, you do not need to be concerned whether the record with the given external ID already exists.
The following example shows how to use the upsert operation. If the record does not exist, it will be added. If the record already exists, it will be updated.
PUT http://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/eid:CID002
{
"firstName": "John",
"lastName": "Smith"
}
Related Topics
- The REST API Browser
- NetSuite Record Structure
- Using CRUD Operations on Custom Records, Custom Lists, and Custom Transactions v1
- Creating a Record Instance
- Getting a Record Instance
- Updating a Record Instance
- Deleting a Record Instance
- Accessing Subresources in REST Web Services
- Using External IDs
- Using Datetime Fields
- Executing Record Actions
- Transforming Records
- Working with the Pricing Sublist on Item Records
- Using the REST Web Services SuiteScript Execution Context