I am trying to update address in vendor using rest...
# ask-stanley-ai
h
I am trying to update address in vendor using rest api and address id is provided in patch request, but it is always creating new address instead of updating.
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like you are trying to update an existing address for a vendor using the REST API. However, the system is creating a new address instead of updating the existing one. This could be due to the way you are structuring your PATCH request. In NetSuite, the addressbook is a keyed sublist with the addressId as the key. When you want to update an address, you need to reference the addressbook line id, not the address subrecord id. Here is an example of how you might structure your PATCH request:
Copy code
json
{
  "addressbookList": {
    "addressbook": [
      {
        "internalId": "addressbook_line_id",
        "defaultShipping": false,
        "defaultBilling": false,
        "isResidential": false,
        "label": "Test Address Update",
        "addressbookAddress": {
          "internalId": "addressbook_line_id",
          "country": "_unitedStates",
          "attention": "Prof X",
          "addressee": "Xavier's Acad",
          "addr1": "123 Marvel Drive",
          "city": "Provo",
          "state": "UT",
          "zip": "84604"
        }
      }
    ],
    "replaceAll": false
  }
}
In this example, replace "addressbook_line_id" with the internalId of the addressbook line you want to update. Also, make sure to set "replaceAll" to false to avoid replacing all addresses. Remember to replace the other fields with your actual data. ****** 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.835876465
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.821716368
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.817993283
Please provide your feedback on this answer.