If you have any question left, please drop a note with the discussion link of this page.
JavaScript Client Library
From Wiki.zanox.com
Here are some helper functions for Java Script
function addScript(url) {
var script = document.createElement("script");
script.src = url + '&t='+new Date().getMinutes();
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
}
// performs a contextual product search
function productSearch(version, applicationid, adspace, region, programs, minPrice, maxPrice, category, page, items, q, callback) {
var url = 'http://api.zanox.com/json/' + version + '/products?applicationid=' + applicationid;
if (adspace) url += '&adspace=' + adspace;
if (region) url += '®ion=' + region;
if (programs) url += '&programs=' + programs;
if (category) url += '&category=' + category;
if (page) url += '&page=' + page;
if (items) url += '&items=' + items;
if (minPrice) url += '&minPrice=' + minPrice;
if (maxPrice) url += '&maxPrice=' + maxPrice;
if (callback) url += '&callback=' + callback;
if (q) url += '&q=' + q;
addScript(url);
}
function exampleProductHandler(data) {
if (data.productsResult) {
var productItems = data.productsResult.productItem;
var zxAdList = document.getElementById('zxAdList'); //ID of a UL HTML element
for (var i = 0; i < productItems.length; i++) {
var productItem = productItems[i];
var link = ;
if (productItem.url.adspace instanceof Array) {
// select tracking link related to the first Adspace
link = productItem.url.adspace[0].$;
}
else {
link = productItem.url.adspace.$;
}
var content = productItem.name + ' bei ' + productItem.program.$ + ' für ' + productItem.price + ' ' + productItem.currency;
renderLinkListItem(content, link, zxAdList);
}
}
}
function renderLinkListItem(content, link, itemContainer) {
var li = document.createElement("li");
li.innerHTML = '<a href="' + link + '">' + content + '</a>';
itemContainer.appendChild(li);
}
// this would start the product search
productSearch('2009-02-01', '..your applicationId..', null, 'de', '660', 0, 1000, null, 0, 5, 'test', 'exampleProductHandler');