Created
December 12, 2011 15:23
-
-
Save martindrapeau/1467822 to your computer and use it in GitHub Desktop.
Planbox My Itemsin All Initiatives
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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