PUT v1/Contacts/{contactID}/UpsertContactAddress

Adds or updates one or more addresses for a contact (upsert). All validation errors across all addresses are collected before any DB writes occur.

Request Information

URI Parameters

NameDescriptionTypeAdditional information
contactID

Must be a valid contact ID that exists in the system.

integer

Required

Body Parameters

Required. List must contain at least one address. ADD: set AddressID = 0. UPDATE: provide an existing AddressID that belongs to this contact. On update: null or omitted fields are ignored (existing DB value kept). Empty string clears the field. If multiple addresses in the request set isPreferred=true, only the last one takes effect.

Collection of UpsertAddressDTO
NameDescriptionTypeAdditional information
AddressID

Set to 0 to create a new address. Provide an existing AddressID to update it.

integer

None.

AddressTypeID

Required. Address type. Accepts single-character ID or full name: M / Mailing, B / Billing, G / Garage, L / Location/Property.

string

None.

Line1

Required. Street address line 1. Max 255 characters.

string

None.

Line2

Street address line 2. Optional. Max 255 characters.

string

None.

City

Required. City name. Max 255 characters.

string

None.

State

State or province. For USA and CAN, must match a known 2-character code or full name (e.g. FL or Florida, ON or Ontario). For other countries, unrecognised values are stored as Province.

string

None.

County

County name. Optional. Max 255 characters.

string

None.

CountryCode

Required on add. 3-character country code (e.g. USA, CAN) or full country name (e.g. United States, Canada).

string

None.

Province

Province or region for non-USA/CAN addresses. Optional. Max 255 characters.

string

None.

Zip

Required. ZIP or postal code. Numbers only (5 digits) or ZIP+4 format (9 digits, e.g. 12345-6789). Max 10 characters.

string

None.

Notes

Optional notes about the address.

string

None.

isPreferred

Whether this is the preferred address for the contact. If multiple addresses in the request have isPreferred = true, only the last one wins.

boolean

None.

Request Formats

application/json, text/json

Sample:
[
  {
    "AddressID": 1,
    "AddressTypeID": "sample string 2",
    "Line1": "sample string 3",
    "Line2": "sample string 4",
    "City": "sample string 5",
    "State": "sample string 6",
    "County": "sample string 7",
    "CountryCode": "sample string 8",
    "Province": "sample string 9",
    "Zip": "sample string 10",
    "Notes": "sample string 11",
    "isPreferred": true
  },
  {
    "AddressID": 1,
    "AddressTypeID": "sample string 2",
    "Line1": "sample string 3",
    "Line2": "sample string 4",
    "City": "sample string 5",
    "State": "sample string 6",
    "County": "sample string 7",
    "CountryCode": "sample string 8",
    "Province": "sample string 9",
    "Zip": "sample string 10",
    "Notes": "sample string 11",
    "isPreferred": true
  }
]

application/x-www-form-urlencoded

Sample:

Failed to generate the sample for media type 'application/x-www-form-urlencoded'. Cannot use formatter 'JQueryMvcFormUrlEncodedFormatter' to write type 'List`1'.

application/xml, text/xml

Sample:
<ArrayOfUpsertAddressDTO xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/QQSolutions.NextGen.ModelLibrary.DataTransferObjects.Contacts">
  <UpsertAddressDTO>
    <AddressID>1</AddressID>
    <AddressTypeID>sample string 2</AddressTypeID>
    <City>sample string 5</City>
    <CountryCode>sample string 8</CountryCode>
    <County>sample string 7</County>
    <Line1>sample string 3</Line1>
    <Line2>sample string 4</Line2>
    <Notes>sample string 11</Notes>
    <Province>sample string 9</Province>
    <State>sample string 6</State>
    <Zip>sample string 10</Zip>
    <isPreferred>true</isPreferred>
  </UpsertAddressDTO>
  <UpsertAddressDTO>
    <AddressID>1</AddressID>
    <AddressTypeID>sample string 2</AddressTypeID>
    <City>sample string 5</City>
    <CountryCode>sample string 8</CountryCode>
    <County>sample string 7</County>
    <Line1>sample string 3</Line1>
    <Line2>sample string 4</Line2>
    <Notes>sample string 11</Notes>
    <Province>sample string 9</Province>
    <State>sample string 6</State>
    <Zip>sample string 10</Zip>
    <isPreferred>true</isPreferred>
  </UpsertAddressDTO>
</ArrayOfUpsertAddressDTO>

Response Information

Resource Description

Action result indicating success or describing all validation errors.

ActionResultDTO
NameDescriptionTypeAdditional information
IsSuccess

Signifies whether action is successful

boolean

None.

ErrorCode

Error code

string

None.

ErrorMessage

Error message

string

None.

InfoMessage

Information message

string

None.

Response Formats

application/json, text/json

Sample:
{
  "IsSuccess": true,
  "ErrorCode": "sample string 2",
  "ErrorMessage": "sample string 3",
  "InfoMessage": "sample string 4"
}

application/xml, text/xml

Sample:
<ActionResultDTO xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/QQSolutions.NextGen.ModelLibrary.DataTransferObjects">
  <ErrorCode>sample string 2</ErrorCode>
  <ErrorMessage>sample string 3</ErrorMessage>
  <InfoMessage>sample string 4</InfoMessage>
  <IsSuccess>true</IsSuccess>
</ActionResultDTO>