The Report Unsubscribe method allows you to return all unsubscribe events tracked for a specific list or campaign.
Arguments
The Report Unsubscribe command requires the following arguments: Command, Realm, Password, and Campaign ID or List ID.
api_web?r=myrealm&p=mypass&c=rpt_unsubscribe&list_id=5
The command is ‘show_user_events’, the realm is ‘myrealm’ and the password is ‘mypass’. The events to return are associated to list id='5'.
api_web?r=myrealm&p=mypass&c=rpt_unsubscribe&campaign_id=11
The events to return are those specific to the campaign with id='11'.
A successful search will return a list of contacts that have unsubscribed from a list.
The Report Unsubscribe command supports the following arguments:
Name |
Req? |
Description |
Argument |
Command |
Yes |
Defines the command to use. |
cmd=rpt_unsubscribe c=rpt_unsubscribe |
Realm |
Yes |
Name of the realm to run the command. This is required, and the command will fail if the realm and password do not match. |
realm=[realm_name] r=[realm_name] |
Password |
Yes |
Authentication code for API access. This is required, and the command will fail if the realm and password do not match. |
pwd=[password] p=[password] |
List ID |
* |
Identifier for the list associated data to return. Required if Campaign iD is not defined. |
list_id=[list_id] |
Campaign ID |
* |
Identifier for campaign associated data to return. Required if List ID is not defined. |
campaign_id=[campaign_id] |
Unique |
To limit your results to the unique clicks per URL, set unique to 1. If set to 0, every click for every contact for the URL in the campaign will be counted. |
unique=[0,1] DEFAULT==0 |
|
Output Format |
|
To specify the format of the list output, use one of two arguments. If no argument is included, the default output is space-delimited plain text string, which may not include all data columns. |
csv=1 or output_format=[csv,csv_tab, csv_pipe,xml] |
Header |
|
To define the data with a label, use the Header argument. This can only be used in conjunction with the output format, and does not affect XML. |
headers=[0,1] DEFAULT==0 |
Example
Using all commands and arguments (please note the command is wrapped for display purposes only):
api_web?c=rpt_unsubscribe&r=myrealm&p=mypass&list_id=5&unique=1&output_format=csv&headers=1
Successful results return:
"email","first_name","last_name","event_date","campaign_id","list_id" "jane@domain.com","Jane","Doe","2012-10-23 17:10:16","11","5" "john@domain.com","John","Doe","2012-10-24 13:46:03","11","5"
Some systems have the ability to define a unique Customer Key per contact. If your realm has Customer Key enabled, and additional column "customer_key" will be included in the results.
Results
The Report Unsubscribe command outputs either the results of the search or a FAILURE message.
SUCCESS
The Report Contact Events command does not explicitly return a Success code. Instead, it outputs the email, first name, last name, event date, campaign id, and list id in plain text format. Use the output_format argument to return the results in an alternate format.
FAILURE
A Report Unsubscribe command will fail for several reasons, such as if the list or campaign doesn't exist. The result format is:
FAILURE: [Reason]