add

The add operation in SOAP web services is used to add a new instance of a record in NetSuite. It is similar to the addList operation except that it allows only one record to be added at a time. Note that to prevent duplicate records, you should use the alternate upsert and upsertList operations along with external IDs to add records to NetSuite.

SOAP Request

In the following example, a single customer record is added.

            <soap:Body>
<platformMsgs:add>
        <platformMsgs:record xsi:type="listRel:Customer">
                <listRel:companyName>Shutter Fly, Inc</listRel:companyName>
                <listRel:unsubscribe>false</listRel:unsubscribe>
        </platformMsgs:record>
</platformMsgs:add>
</soap:Body> 

          

SOAP Response

In the response, notice that the internal ID for the record added is returned.

            <soapenv:Body>
<addResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
<writeResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
   <ns1:status isSuccess="true" xmlns:ns1="urn:core_2017_1.platform.webservices.netsuite.com"/>
      <baseRef internalId="979" type="customer" xsi:type="ns2:RecordRef"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ns2="urn:core_2017_1.platform.webservices.netsuite.com"/>
</writeResponse>
</addResponse>
</soapenv:Body> 

          

In REST web services, you can create a new record using the POST HTTP method. The POST method expects a request body (a JSON object) that conforms to the record's metadata schema and contains values for at least each required field of the given record type.

REST Request

In the following example, a single customer record is added.

            POST https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer
{ "entityid": "New Customer", "companyname": "Shutter Fly, Inc", "subsidiary": { "id": "1" } } 

          

REST Response

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 newly created record is given in the Location header of the response.

            Date Fri, 04 Jan 2025 08:50:20 GMT
Location https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/647
Content-Type application/json 

          

Related Topics

General Notices