/statuses/lookup multiple lookups


#1

Am using:
Twitter REST API 1.1
Node.js
npm node-twitter
statuses/lookup

I’m posting 2 id_str to statuses/lookup but I’m getting the tweet detail of only first id_str

Somewhere I read that we need to URL encode the id_str’s and then capitalize it and then pass it as parameter! So I did that too.

    var id = encodeURIComponent(req.params.id_str1,req.params.id_str2);
          id = id.toUpperCase();
    twit.get('/statuses/lookup', {'id': id}, function(error, params, response){
      res.json(params);
    });

req.params.id_str1 and req.params.id_str2 are parameters of my get request in node.
Here too am only getting the tweet details of 1st id_str1.

Any input is highly appreciated …thanks a lot


#2

The documentation for id specifies:

A comma separated list of tweet IDs, up to 100 are allowed in a single request.

Example Values: 20,432656548536401920

So to prepare the value all you need to do is:

var id = [req.params.id_str1, req.params.id_str2].join(',');
twit.get('/statuses/lookup', {'id': id}, function(error, params, response){
    res.json(params);
});

#3

Thanks a lot abraham… that solved my issue :sunny:


#4