Updating a Record Instance

In the following example, the name of a specific customer record instance is updated. In REST web services, you can perform such an update using the PATCH HTTP method. The PATCH method expects a request body with the same fields that can be retrieved using the GET method. That is, the record's metadata schema is shared between reads and updates.

Note:

Not all record fields can be updated using the PATCH method. For example, the id field is considered to be read-only.

Any omitted fields are considered unchanged.

In this example, the name (entityid) of the record instance 107 retrieved in the previous example is changed from "Alan Rath" to "Updated Customer". Send the following request to perform the update.

          PATCH https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/107
BODY { "entityid": "Updated Customer" } 

        

The following is an excerpt from the response headers of a successful operation, with no body content returned (HTTP Code 204). The URL of the updated record is given in the Location header of the response.

          Date Fri, 04 Jan 2019 09:07:01 GMT
Location https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/107
Content-Type application/json 

        

Deleting Body Fields from a Record

To delete body fields from a record, consider the following. If the value of a body field is set to null, the body field is deleted. You can also use the replaceSelectedFields=true query parameter to indicate that only the body fields included in the query parameter with the value set to null should be deleted.

            PATCH ../myrecord?replaceSelectedFields=true&replace=body1

{
    "body1" : null
} 

          

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
Using the Upsert Operation
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

General Notices