how to add an address to a subcustomer that does n...
# ask-stanley-ai
j
how to add an address to a subcustomer that does not have one via the REST API
c
AI generated answer (using internal Slack threads):
To add an address to a subcustomer that does not have one via the REST API, you can follow these steps: 1. First, you need to create the customer record without the address information using the REST API. 2. After creating the customer record, 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 address record with the desired information. 4. After creating the address record, use the "AddressBook" sublist on the customer record to associate the address with the customer. Here is a sample structure for adding an address to the AddressBook:
Copy code
json
"addressBook": {
  "items": [
    {
      "addressBookAddress": {
        "country": "AU",
        "state": "Victoria"
      },
      "defaultShipping": true
    }
  ]
}
Please note that the addressbook is a keyed sublist with the addressId as the key. If you want to remove an address, you need to follow the directions for replacing a sublist. This involves getting the AddressBook(List), iterating, and deleting an address record there. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836280584
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.835494816
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83406949
Please provide your feedback on this answer.
j
POST, PUT, or PATCH when adding an address?