Follow

Get Subscriptions by Customer Key

The Get Subscriptions command allows you to get all Subscriber and Custom Data and List Subscriptions for a Subscriber specified by the Customer Key in Accounts where the option is enabled. 

GET /subscribers/[customerKey]/subscriptions

https://[siteurl]/rest/subscribers/[customerKey]/subscriptions

Request Body Parameters

The Get Subscriptions by Customer Key command requires only the URI call with the Customer Key and Subscriptions parameter. No additional fields are required in the JSON.    

Request Body Example

Using Get Subscriptions:

curl --request GET \ 
--url 'https://mail.mydomain.com/rest/subscribers/ck10/subscriptions' \
--header 'authorization: Basic bXlBY2NvdW50Onh5enB3ZDEyMw==' \
--header 'accept: application/vnd.whatcounts-v1+json' \
--header 'content-type: application/json' \
--include

Response Body

The response returns all API available Fields in JSON format for the specified Subscriber.

Based on the example above, the response returns:


HTTP/1.1 200 OK
Server: serverName
Content-Type: application/json
Link: <https://mail.mydomain.com/rest/subscribers/ck10/subscriptions>;
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": ""
"createdDate": "May 21, 2012 9:14:16 AM"
"updatedDate": "Nov 2, 2015 10:31:27 AM"
"customerKey": "ck10"
"ipAddress": ""
"md5Encryption": "C8ADED17D5F088E8262BF31ED933B7D4"
"sha1Encryption": "356B1860247728C81486A35062688F302D96C2D1"
"subscriptions": 
{
"subscriptionId": 31263419
"subscriberId": 10
"listId": 11
"formatId": 2
"createdDate": "Jul 13, 2015 3:28:59 PM"
"listName": "Monthly Mailer"
"skip": 3
"max": 0
} 
{
"subscriptionId": 31263417
"subscriberId": 10
"listId": 5
"formatId": 1
"createdDate": "Jul 13, 2015 3:28:59 PM"
"listName": "myList"
"skip": 2
"max": 0
}
{
"subscriptionId": 31263418
"subscriberId": 10
"listId": 10
"formatId": 99
"createdDate": "Jun 13, 2015 9:28:59 PM"
"listName": "list Subscriptions"
"skip": 1
"max": 0
}
"customData": {
  "text": "text"
  "unicode": "unicode text"
  "large": "big"
  "number": 12
  "float": 12.12
  "date": "2016-07-04"
},
"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 specified Subscriber does not exist, the error would appear as:

{
"error": "Unable to find resource with customerKey = ck10"
"status": "Not Found"
"statusCode": 404
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk