If you have any question left, please drop a note with the discussion link of this page.

RESTful API V2009-05-01

From Wiki.zanox.com

(Redirected from RESTful API V20090501)
Jump to: navigation, search

Products
  GET: Retrieving a single product item
  GET: Retrieving all product items by advertiser program
  GET: Contextual Product Search
Admedia
  GET: Retrieving a single admedium item
  GET: Retrieving a list of admedia items
  GET: Retrieving admedia categories
Programs
  GET: Retrieving a single program item
  GET: Retrieving all program items
  GET: Programsearch
  GET: Retrieving programs for a given category
  GET: Returns the last 20 advertiser program news
  GET: Returns all available program categories
  GET: Returns all programs for a specified user adspace
  POST: Creating a new program application
  DELETE: Deleting an existing program application
Reports
  GET: Retrieving a single sale item
  GET: Retrieving a single lead item
  GET: Retrieving all sale items
  GET: Retrieving all lead items
  GET: Retrieving aggregated report
Payments
  GET: Retrieving all payment items
  GET: Retrieving a single payment item
  GET: Retrieving all balance items
  GET: Retrieving a single balance item
  GET: Retrieving all account items
  GET: Retrieving a single account item
Adspaces
  GET: Retrieving a single adspace item
  GET: Retrieving all adspace items related to the user
  POST: Creating a new advertising space
  PUT: Updating properties of an advertising space
  DELETE: Removing an advertising space
Profiles
  GET: Retrieve the user profile
  PUT: Update the user profile

Contents

API Location

Two different RESTful interfaces are available: XML and JSON. Both are available via http or https. The API can be used without a version parameter in the URL. If used without the version parameter the latest API version is always taken. In order to stick to a certain version the release date of the API has to be provided as a parameter.

API with version support

http(s)://api.zanox.com/json/2009-05-01
http(s)://api.zanox.com/xml/2009-05-01


To see the differences between versions, please check Version History

API Authentication

Two different types of authentication are necessary to use the RESTful API. The implementation details can be found in the
RESTful API authentication process section.

If you don't have coded a signature-calculating-routine yet, you may use our SigntureTool [1].

Callback Handler

The zanox API cannot be called via AJAX due to the same origin policy.

Instead, the API offers a callback parameter for use with a dynamic script tag.

Following are two examples of a product search for "auto" in the advertiser programs with ID 660, 10, 20, and 30.

Usage of 'callback=function' with static script tag

<script>
  function myCallbackHandler(jsonData){
  // Do something with the jsonData returned by the API query.
  }
</script>
<script src="http://api.zanox.com/json/2009-07-01/products?q=auto&programs=660,10,20,30&connectid=580599047DF8F5311043&callback=myCallbackHandler"> </script>
 

Usage of 'callback=function' with dynamic script tag

<script>
  function callAPI(url){
    var script = document.createElement('script');
    script.src = url; // Sets the script's source to the Rest/JSON API query.
    script.type = "text/javascript";
 
    document.getElementsByTagName('head')[0].appendChild(script); 
    // The browser performs a request to the zanox API. 
    // As soon as the script tag's source is loaded, the callback function is called.
    }
 
    function myCallbackHandler(jsonData){
    // Do something with the jsonData returned by the API query.
    }
 
  var url = 'http://api.zanox.com/json/2009-07-01/products?q=auto&programs=660,10,20,30&connectid=580599047DF8F5311043&callback=myCallbackHandler';
  callAPI(url); // This call could, for instance, be moved to an HTML element's "onclick" event
</script>

Both examples result in the dynamic creation and execution of the following:

 
<script>
myCallbackHandler({"page":0,"items":10,"total":85622,"query":"auto","productItems":{ ... });
</script>
 

API RESTful Resources

The RESTful API contains RESOURCES that can be accessed for various actions. Actions refers to the HTTP commands GET/POST/PUT and DELETE. The GET command means retrieving a resource, POST means creating a resource, PUT means updating a resouce and DELETE means removing a resource.

Resources are advertising spaces, product offerings, advertising media, advertiser programs, transaction reports and user profiles. Be aware that not all of these resources can be modified.

Products Resource

Using the REST V2009-05-01 Products you can access 70 mio product offer items using contextual product search, product download, incremental product download

Admedia Resource

With the REST V2009-05-01 Admedia you can access 300.000 advertising media (banners, text links, etc.)

Programs Resource

With the REST V2009-05-01 Programs you can search for affiliate programmes, retrieve affiliate programmes, and apply to affiliate programmes

Reports Resource

With the REST V2009-05-01 Reports you can retrieve Leads and Sales

Payments Resource

With the REST V2009-05-01 Payments you can do operations on payments

Adspaces Resource

With the REST V2009-05-01 Adspaces you can do operations on advertising spaces.

Profiles Resource

With the REST V2009-05-01 Profiles you can do operations on profiles

Personal tools