Follow

Update Contact by Email + First Name

The Update Contact command allows you to make changes to an existing Contact's Data.  See REST API Contacts Overview for a table of Contact data available to PUT.

PUT /subscribers

https://[siteurl]/rest/subscribers

Request Body Parameters

The Update Contact by by Email + First name command requires the Contact Email and First name defined within the submitted JSON in order to update. No additional fields are required in the JSON other than those to change, and can be found in the Data Fields table in REST API Contact's Overview.   

Request Body Example

Using Update Contact with all arguments, line breaks in JSON for readability:

curl --request PUT \ 
--url 'https://mail.mydomain.com/rest/subscribers' \
--header 'authorization: Basic bXlBY2NvdW50Onh5enB3ZDEyMw==' \
--header 'content-type: application/json' \
--header 'accept: application/vnd.whatcounts-v1+json' \
--data '{ "email": "jon.doe@mydomain.com", "firstName": "Jon", "lastName": "Doe", "company": "My Company", "address1": "123 Some Street North", "address2": "Suite 500", "city": "My City", "state": "WA", "zip": "98000", "country": "United States", "phone": "(206) 555 1212", "fax": "(206) 555 1313", "customData": { "text": "text Updated", "unicode": "unicode text Updated", "large": "big text Updated", "number": 121, "float": 11.11, "date": "2016-07-11" } }' \
--include

Response Body

The response returns all API available Contact and Custom Data in JSON format.  Blank data fields are not returned.  Based on the example above, the response returns:

HTTP/1.1 200 OK
Server: serverName
Content-Type: application/json
Content-Length: 926
Link: <https://mail.mydomain.com/rest/subscribers>;
Date: Fri, 17 Jun 2016 12:54:44 GMT
{
"subscriberId": 10
"realmId": 1561
"email": "jon.doe@mydomain.com"
"firstName": "Jon"
"lastName": "Doe"
"company": "My Company"
"address1": "123 Some Street North"
"address2": "Suite 500"
"city": "My City"
"state": "WA"
"zip": "98000"
"country": "United States"
"phone": "(206) 555 1212"
"fax": "(206) 555 1313"
"createdDate": "May 21, 2012 9:14:16 AM"
"updatedDate": "Jun 17, 2016 10:31:27 AM"
"ipAddress": ""
"md5Encryption": "C8ADED17D5F088E8262BF31ED933B7D4"
"sha1Encryption": "356B1860247728C81486A35062688F302D96C2D1"
"customData": {
  "text": "text Updated"
  "unicode": "unicode text Updated"
  "large": "big text Updated"
  "number": 121
  "float": 11.11
  "date": "2016-07-11"
},
"skip": 1
"max": 0
}

Error Response

Error Response Codes include both Client Errors (4xx) and Server Errors (5xx).  Descriptions of each can be found in Response Codes

For example, if the required Email Address is invalid, the error would appear as:

{
"error": "The Email field must be at least 5 characters long"
"status": "Internal Server Error"
"statusCode": 500
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk