The following API calls are currently available for the SurveyCampaign object:
GET LIST - Get a list of all of links and campaigns for the specified survey.
https://api.alchemer.com/v4/survey/123456/surveycampaign
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
page | page=3 | False |
resultsperpage | resultsperpage=100 | False |
Response Example (.debug format):
Array
(
[result_ok] => 1
[total_count] => 8
[page] => 1
[total_pages] => 1
[results_per_page] => 50
[data] => Array
(
[0] => Array
(
[id] => 100000
[_type] => SurveyCampaign
[_subtype] => link
[__subtype] => standard
[status] => Active
[name] => Default Link
[uri] => {publish link}
[SSL] => False
[tokenvariables] =>
[limit_responses] =>
[close_message] =>
[language] => Auto
[datecreated] => 2012-04-30 13:22:35
[datemodified] => 2012-04-30 13:22:35
)
[1] => Array
(
[id] => 100001
[_type] => SurveyCampaign
[_subtype] => email
[__subtype] => standard
[status] => Deleted
[name] => My New Email Campaign
[uri] => {publish link}
[SSL] => False
[tokenvariables] =>
[limit_responses] =>
[close_message] => This survey is now closed.
[language] => Auto
[datecreated] => 2012-05-03 15:20:41
[datemodified] => 2012-05-03 15:21:25
GET CAMPAIGN - Get information about specified link or campaign.
https://api.alchemer.com/v4/survey/123456/surveycampaign/100000
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
Response Example (.debug format):
Array
(
[result_ok] => 1
[data] => Array
(
[id] => 100000
[_type] => SurveyCampaign
[_subtype] => link
[__subtype] => standard
[status] => Active
[name] => Default Link
[uri] => {publish link}
[SSL] => False
[tokenvariables] =>
[limit_responses] =>
[close_message] =>
[language] => Auto
[datecreated] => 2012-04-30 13:22:35
[datemodified] => 2012-04-30 13:22:35
)
)
CREATE CAMPAIGN - Create a new link or campaign.
When creating campaigns via either the API or the UI, a default message is created. So, while you might think your next step is to use the EmailMessage object to create a message, you don't need to!
https://api.alchemer.com/v4/survey/123456/surveycampaign?_method=PUT&type=link&name=New Link Name
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
type | link, email, html, js, blog, iframe, popup | True |
name | New Link Name | True |
language | auto, english, etc. | False |
status | active, closed, deleted | False |
slug (link only) | newlinkslug | False |
subtype (link only) | standard, private, shortlink | False |
tokenvariables | var%3Dvalue%26var2%3d=value | False |
Protocol is not an available parameter, however, if you use the Force HTTPS linkssetting under Account > Account Settings, all links created via the API will be set to the secure protocol.
Response Example (.debug format):
Array
(
[result_ok] => 1
[data] => Array
(
[id] => 100000
[_type] => SurveyCampaign
[_subtype] => link
[__subtype] => standard
[status] => Active
[name] => NewLink
[uri] => {publish link}
[SSL] => False
[tokenvariables] =>
[limit_responses] =>
[close_message] =>
[language] =>
[datecreated] => 2013-01-08 13:17:44
[datemodified] => 2013-01-08 13:17:44
)
)
UPDATE/COPY CAMPAIGN - Update and/or copy a specified link or campaign.
https://api.alchemer.com/v4/survey/123456/surveycampaign/100000?_method=POST
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
name | UpdatedLinkName | False |
language | auto, english, etc. | False |
status | active, closed, deleted | False |
slug (link only) | updatedlinkslug | False |
subtype (link only) | standard, private, shortlink | False |
privatename (link only)* | awesomesurveys.com | False |
tokenvariables | var%3Dvalue%26var2%3d=value | False |
copy | true | False |
*v4 only
Response Example (.debug format):
Array
(
[result_ok] => 1
[data] => Array
(
[id] => 100000
[_type] => SurveyCampaign
[_subtype] => link
[__subtype] => standard
[status] => Active
[name] => UpdatedLinkName
[uri] => {publish link}
[SSL] => False
[tokenvariables] =>
[limit_responses] =>
[close_message] =>
[language] =>
[datecreated] => 2013-01-08 12:40:47
[datemodified] => 2013-01-08 13:53:35
)
)
DELETE CAMPAIGN - Delete specified link or campaign.
https://api.alchemer.com/v4/survey/123456/surveycampaign/100000?_method=DELETE
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
Response Example (.debug format):
Array
(
[result_ok] => 1
)