API: Campaigns
A Campaign resource represents a group of multiple related ads. It provides a convenient way to group ads so that they can be scheduled together and managed easily.
Supported Methods
| URI | GET | POST | PUT | DELETE |
|---|---|---|---|---|
| /resources/campaigns/ | List | Create | - | - |
| /resources/campaigns/<campaign_id>.<format> | Read | - | Update | Delete |
List campaigns
- URL -
http://<subdomain>.trafficspaces.com/resources/campaigns/ - Method -
GET - Parameters -
- page - (unsigned, optional) an integer value that specifies which page of results to fetch, starting at 1. Default: 1. Minimum: 1.
- pagesize - (unsigned, optional) how many results to fetch in each request. Default: 25. Maximum: 100
- Response
- Status -
200, if successful. - Body - A collection of up to pagesize campaigns in the requested format
- Status -
Read a campaign
- URL -
http://<subdomain>.trafficspaces.com/resources/campaigns/<campaign_id>.<format> - Method -
GET - Parameters - None
- Response
- Status -
200, if successful. - Body - The requested campaign in the requested format
- Status -
Create a new campaign
- URL -
http://<subdomain>.trafficspaces.com/resources/campaigns/ - Method -
POST - Parameters - XML or JSON data. See the Attributes below
- Response
- Status -
201, if successful. - Body - The created campaign in the requested format
- Headers
- Location - A relative URL for the newly created campaigns
- Status -
Update an existing campaign
- URL -
http://<subdomain>.trafficspaces.com/resources/campaigns/<campaign_id>.<format> - Method -
PUT - Parameters - XML or JSON data. See the Attributes below
- Response
- Status -
200, if successful. - Body - The updated campaign in the requested format
- Status -
Delete an existing campaign
- URL -
http://<subdomain>.trafficspaces.com/resources/campaigns/<campaign_id>.<format> - Method -
DELETE - Parameters - None
- Response
- Status -
200, if successful.
- Status -
Attributes
- campaign - (object, rwa)
- id - (string, r) the alphanumeric unique identifier
- name - (string, rwa) the display name in the ad store.
- realm - (string, r) the subdomain name of the ad store
- creation_date - (datetime, r) the date on which the campaign was created.
- last_modified_date - (datetime, r) the date on which the campaign was last modified.
- linked_user - (object, rw)
- id - (string, rw) the alphanumeric unique identifier of the user that created the campaign
- name - (string, r) the username of the user that created the campaign
- linked_ads - (collection, rwa, optional) contains
one or more linked_ad objects each of which represents an ad
that is part of this campaign
- linked_ad - (object, rwa, optional)
- id - (string, rw) the alphanumeric unique identifier of the ad
- name - (string, r) the display name of the ad
- linked_ad - (object, rwa, optional)
Examples
Campaign - JSON
{
"id": "16310e6b",
"name": "Classic CD Campaign",
"realm": "demo",
"creation_date": "2011-04-05T22:54:55",
"last_modified_date": "2011-04-12T15:27:05",
"linked_ads": {
"linked_ad": [
{
"id": "160f3c2c",
"name": "Bob Marley CDs"
},
{
"id": "16210e68",
"name": "Bruce Springsteen CDs"
}
]
},
"linked_user": {
"id": "0937111d0e6b33150a0e6f66",
"name": "admin@mywebsite.com"
}
}
Campaign - XML
<?xml version="1.0" encoding="UTF-8"?>
<campaign>
<id>16310e6b</id>
<name>Classic CD Campaign</name>
<realm>demo</realm>
<creation_date>2011-04-05T22:54:55</creation_date>
<last_modified_date>2011-04-12T15:27:05</last_modified_date>
<linked_ads>
<linked_ad>
<id>160f3c2c</id>
<name>Bob Marley CDs</name>
</linked_ad>
<linked_ad>
<id>16210e68</id>
<name>Bruce Springsteen CDs</name>
</linked_ad>
</linked_ads>
<linked_user>
<id>0937111d0e6b33150a0e6f66</id>
<name>admin@mywebsite.com</name>
</linked_user>
</campaign>