Reputation: 552
Looking for a way to send an array of KloutId to their API and get back their Klout Topics. All I can find in the Klout docs is a way to send a single user. eg:
http://api.klout.com/v2/user.json/635263/topics?key=API_KEY_HERE
Basically running up against their rate limits, would like to batch in groups of 10 to be able to grab 100 users total. I am using Node.js
Current Code:
async.series([
function(callback){
// call to twitter api to get friends
T.get('friends/ids', { screen_name: screenname }, function (err, data, response) {
if(err) console.error(err)
friends = data;
callback(null);
})
},
function(callback){
friends.forEach(function(friend){
var friend = JSON.stringify(friend)
request(`http://api.klout.com/v2/identity.json/tw/${friend}?key=${process.env.KLOUT}`, function(err, res, body){
kloutId = JSON.parse(body).id;
// get topics
request(`http://api.klout.com/v2/user.json/${kloutId}/topics?key=${process.env.KLOUT}`, function(err, res, body){
var topics = JSON.parse(body)
for(var topic in topics){
console.log("Topic: ", topics[topic].displayName)
}
})
})
})
callback(null);
}
],
function(err, results){
// Pick off top 10 topics of all users here
});
Upvotes: 0
Views: 87
Reputation: 552
Appears the bulk requests are no longer supported:
"To ensure the highest data availability and the lowest latency, you will no longer be able to make bulk user calls. Rate limits will be increased to compensate."
http://developer.klout.com/blog/read/api_v2_launch
Upvotes: 1