Follow

Update Subscription

The Update Subscription command allows you to change the format of a Subscription.  See REST API Subscriptions Overview for a table of Subscription data available to POST. 

POST /subscriptions/[subscriptionId]

https://[siteurl]/rest/subscriptions/[subscriptionId]

Request Body Parameters

The Update Subscription command requires the subscription ID in the URI, and the following in the Posted JSON:

  • Format: "formatId": [0,1,2,99], where 0=auto plain text 1=plain text, 2=html, and 99=MIME 

Request Body Example

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

curl --request POST \ 
--url 'https://mail.mydomain.com/rest/subscriptions\120002' \
--header 'authorization: Basic bXlBY2NvdW50Onh5enB3ZDEyMw==' \
--header 'content-type: application/json' \
--header 'accept: application/vnd.whatcounts-v1+json' \
--data '{ "formatId": 1 }' \
--include

Response Body

The response returns all available Subscription data.  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
{
"subscriptionId": 120002
"subscriberId": 7160984 "listId": 5 "formatId": 1 "createdDate": "Jun 17, 2016 1:12:54 PM" }

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 a Subscription already exists for the Subscriber, the error would appear as:

{
"error": "Update failed: Unable to verify subscriber."
"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