Skip to content

Instantly share code, notes, and snippets.

@tinybeans
Created January 30, 2014 20:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tinybeans/8718253 to your computer and use it in GitHub Desktop.
Save tinybeans/8718253 to your computer and use it in GitHub Desktop.
複数のブログの記事数をData APIで取得してみる
var api = new MT.DataAPI({
baseUrl: '/mt_dir/mt-data-api.cgi',
clientId: 'mt data api test.'
});
var blog_ids = [1, 2, 3];
var total = 0;
var responsed = 0;
for (var i = 0, l = blog_ids.length; i < l; i++) {
api.listEntries(
blog_ids[i],
{
fields : "title,permalink,date"
},
function(response) {
responsed++;
total += Number(response.totalResults);
if (responsed == l) {
$("#result").html("total Rows = "+ total +"件");
}
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment