Skip to content

Instantly share code, notes, and snippets.

@martindrapeau
Created December 12, 2011 15:23
Show Gist options
  • Save martindrapeau/1467822 to your computer and use it in GitHub Desktop.
Save martindrapeau/1467822 to your computer and use it in GitHub Desktop.
Planbox My Itemsin All Initiatives
$.post('https://www.planbox.com/api/get_products', function(data) {
var products = data.content;
var product_ids = [];
var product_id2name = {};
for (var i=0; i<products.length; i++) {
var product = products[i];
product_id2name[product.id] = product.name;
product_ids.push(product.id);
}
$.post('https://www.planbox.com/api/get_stories',
{product_id:product_ids, timeframe:'current', resource_id:890},
function(data) {
var stories = data.content;
for (var i=0; i<stories.length; i++) {
var story = stories[i];
console.log('#'+story.id+' '+product_id2name[story.product_id]+' '+story.name);
}
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment