0

I am trying to get the list of user id, screen name and profile image link of all the users, that I am following on twitter from the application in iOS5. For that Initially I am posting following link to get the user_id of all my friends-

"https://api.twitter.com/1/friends/ids.json"

Once I receive the response for above URL which is list of all the user_ids of friends I am following on Twitter, I concatenate all the user ids in single String, and then use the following URL, to get the JSON, which will contain the required details for all the users that I am following --

"https://api.twitter.com/1/users/lookup.json?user_id=420107765,383684745,312790865,85462891,164199168,140856038&include_entities=screen_name"

Here, the problem I am facing is, if the number of friends I am following is more, I am getting API limit exceed error, although I am making API calls only 2 times.

What is shocking is, I still can make other twitter API calls, but when I make lookup/users call to get the info of just 5 to 10 users, still it gives me following error ---

Printing description of result:

{
    error = "Rate limit exceeded. Clients may not make more than 150 requests per hour.";
    request = "/1/users/lookup.json?user_id=50851703,86254626,88856792,6253282,18839785,145125358,135421739,170416270&include_entities=True&application_id=uk.co.vipul.twt";
}

Can someone please give me the solution for this problem? Thanks in advance !!!

1
  • I am banned to post d answers, so commenting the answer here- I got the problem solved. Actually, the URL which i am creating to send the request was directly containing "commas", and hence it was giving me API exceeding error(not logical to give such error though). When I removed direct commas in URL and replaced them with '%2C' it worked !! I hope this will help to those who are trying it and getting same problems. ===================== New working URL--- "api.twitter.com/1/users/…"
    – vipsk
    Jul 30, 2012 at 16:44

1 Answer 1

1

First, there is an upper limit of 100 UIDs/Screen Names. The actual API doc page for this (https://dev.twitter.com/docs/api/1/get/users/lookup) doesn't say whether you can include 100 screen names, then 100 UIDs, and get 200 results per call? Probably someone has discussed this in forum/blog, but not the doc page. To be safe, make sure you limit your request to <= 100 UIDs in each call.

Another item I am not sure of is, include_entities should be True/False? If you include entities, you get back the entity info. I am not sure it works at all when used this way, but even if it does, it would seem logical to expect the result to be just the Screen Names from the tweet entity (which is not the same as screen name in the user).

I believe if you limit the number of UIDs, and set include_entities to a valid (appropriate) value, you will get a JSON object that contains a great deal of info about all the UIDs. You can then extract the info from this object, as planned.

1
  • Here, I am requesting the info for just 5 to 10 user ids, even in that case I am getting following error message from twitter -- Printing description of result: { error = "Rate limit exceeded. Clients may not make more than 150 requests per hour."; request = "/1/users/lookup.json?user_id=50851703,86254626,88856792,6253282,18839785,145125358,135421739,170416270&include_entities=True&application_id=uk.co.vipul.twt"; } Thing, to be wondered is,When I am making any other request for twitter API, its still working, but for this request its giving me the above error of 150requests per hour
    – vipsk
    Jul 20, 2012 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.