Apologies if this has been asked before; I'm crea...
# suitetalkapi
k
Apologies if this has been asked before; I'm creating a customer record via the rest API and was hoping to also create a contact sub-record in the same call like AddressBook, anyone know if thats possible? I've been unsuccessful thus far, I've tried the below structure which works for adding to the address book Cheers
Copy code
"addressBook": {
  "items": [
    {
     "addressBookAddress": {
     "country": "AU",
     "state": "Victoria"
    },
   "defaultShipping": true
  }
 ]
},
"contactRoles": {
  "items": [
    {
      "contact": {
        "firstName": "Kane",
        "email": "<mailto:kane@test.com|kane@test.com>"
      },
     "role": {
       "id": "14"
     }
   }
 ]
},
m
I believe creating both the customer and the contact sub-record in a single API call is not currently possible with NetSuite's REST API. The structure you provided is correct for adding entries to the Address Book and Contact Roles sublists, which are standard sublists on the customer record. However, NetSuite's REST API does not support adding custom sublists like "Contact" directly through the customer record creation call. To add a contact sub-record, you will need to first create the customer record without the contact information and then make a separate API call to create the contact record and associate it with the customer using the "Contact Roles" sublist. Here are the steps you can follow: 1. Create the customer record without the contact information using the REST API. 2. Extract the customer's internal ID from the response of the first API call. 3. Use the internal ID of the customer to make a second API call to create the contact record with the desired information. 4. After creating the contact record, use the "Contact Roles" sublist on the customer record to associate the contact with the customer.
🙏 1
🙌 2