0
votes

We are using the REST API to Upsert customer record. Included in the PUT is the address record.

Everytime we send the PUT, the customer record is updated as expected. The problem is that every time we run the request, a new address is added to the address book.

"companyName"=> $result['CLIENTNAME'],
"email"=> '',
"emailPreference"=> "PDF",
"emailTransactions"=> false,
"externalId"=> $netsuiteCustomerId,
"isinactive"=> false,
"phone"=> $result['TELEPHONENO'],
"subsidiary"=> ["id"=> "2"],
"terms"=> ["externalId"=> "PTTRM".$result["TERMID"]],
"vatRegNumber"=> $result['ABN'],
"addressbook" => array(
    "items" => array(
        array(
            "label"=> $address['addr1'],
            "addressbookaddress" => $address = array(
                "addr1" => $result['ADDRESS1'],
                "addressee" => $result['CLIENTNAME'],
                "addrText"=> $result['ADDRESS1']."\n".$result['ADDRESS2'],
                "externalId" => 'ADDR_'.$netsuiteCustomerId,
            );
        )                
    )
)

Adding the externalId to the address doesn't appear to work. We have multiple addresses with the same ID. The SOAP API allows a replaceAll attribute, but that doesn't exist on the REST API.

2

2 Answers

0
votes

I haven't tried doing this myself but you may want to check the documentation again (https://docs.oracle.com/cloud/latest/netsuitecs_gs/NSTRW/NSTRW.pdf). It shows samples of replacing sublists using 'replace' in the query parameter.

The REST API browser also mentions 'replace' under request parameters.

0
votes

You need to use PATCH instead of PUT to update the address