The Trafficspaces API consists of two discrete APIs
- Ad Store API - a read-write HTTP programmatic interface that helps you interact with your ad store.
- Ad Server API - a read-only HTTP interface that helps you to retrieve ads from the ad servers.
Both APIs have been implemented with RESTful design patterns, which means you can interact with the resources in the system using three basic elements:
- The base URI of the resource, such as
- The MIME type of the data being submitted or requested. This
can be either
- The HTTP verb for the operation such as GET, POST, PUT or DELETE.
When you are using the Ad Store API, all your requests should be relative to the URI of your ad store, i.e.
However when you using the Ad Server API, all your requests should be relative to the URI of the ad serving system i.e.
See the Authentication guide for more details.
Through the APIs, you can interact with the following types of resource
|Ad Store API||Ad Server API|
Each resource has one or more attributes, where the attribute values conform to one of the following data types
- string - any printable character in the UTF-8 character set.
- integer - any number between -231 and 231-1.
- unsigned - any number between 0 and 231-1.
- double - any number between 2-1074 and (2-2-52)·21023.
- boolean - either true or false.
- date must be specified in the YYYY-MM-DD ISO-8601 format e.g. 2010-12-31.
- datetime must be specified in the YYYY-MM-DDThh:mm:ss ISO-8601 format e.g. 2010-12-31T00:00:00+0000. All time zones are relative to the ad store's time zone setting.
- object - a group of key and value pairs in XML or JSON format
- collection - a series of objects in XML or JSON format
Each value in a resource can have one of more of the following access modifiers
- r - the value can be read multiple times
- w - the value can be written at most once. This is usually only when the resource is created.
- a - the value can be amended multiple times throughout the lifetime of the resource.
You can request data in XML or JSON format by setting the HTTP
Alternatively, the response format can be inferred from the file
extension of the resource requested by the URL i.e.
You can send url encoded query parameters data if you are making
However if you wish to use either the
POST verbs, you must
- Format your data in either XML or JSON, and
- Set the appropriate
Alternatively, the data format can be inferred from the extension (if any) of the resource URL i.e.
See the API Code Samples & Libraries section for more details.
We recommend that you use the Curl command line utility to debug your requests.
For example, to view XML data received from a user request, you can make a call in this format
curl -u <api-user>:<api-key> https://<subdomain>.trafficspaces.com/resources/users/<username>.xml
or also like this alternative format
curl -u acme:abcdefghijklmnopqwsrtuvwzyz https://acme.trafficspaces.com/resources/users/foo.xml
To receive more detailed request and response data, add the
--verbose flag to your request to receive even more
curl --verbose -u acme:abcdefghijklmnopqwsrtuvwzyz https://acme.trafficspaces.com/resources/users/foo.xml