• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Twitter REST API Method: friends ids

Page history last edited by Marcel Molina 14 years, 2 months ago

<< Back to Twitter API Documentation

 

friends/ids

Returns an array of numeric IDs for every user the specified user is following.

method status | report a bug

 

URL:

http://api.twitter.com/1/friends/ids.format

 

Formats: 

xml, json

 

HTTP Method(s):

GET

 

Requires Authentication (about authentication):

false unless requesting it from a protected user; if getting this data of a protected user, you must auth (and be allowed to see that user).

 

API rate limited (about rate limiting):

1 call per request

 

Parameters:

  • One of the following:
    • id.  Optional.  The ID or screen_name of the user to retrieve the friends ID list for.
      • Example: http://api.twitter.com/1/friends/ids/bob.xml
    • user_id.  Optional.  Specfies the ID of the user for whom to return the friends list. Helpful for disambiguating when a valid user ID is also a valid screen name.
      • Example: http://api.twitter.com/1/friends/ids.xml?user_id=1401881
    • screen_name.  Optional.  Specfies the screen name of the user for whom to return the friends list. Helpful for disambiguating when a valid screen name is also a user ID.
      • Example: http://api.twitter.com/1/friends/ids.xml?screen_name=101010
  • cursor. Required. Breaks the results into pages. A single page contains 5000 identifiers. This is recommended for all purposes. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
    • Example: http://api.twitter.com/1/friends/ids/barackobama.xml?cursor=-1
    • Example: http://api.twitter.com/1/friends/ids/barackobama.xml?cursor=-1300794057949944903

 

Notes:

  • Returned sets aren't guaranteed to contain 5000 IDs, as suspended users will be filtered out.
  • If the cursor parameter is not provided, an effort is made to return all IDs, but will probably fail with a timeout or return inconsistent or incomplete results. This behavior is deprecated and will be removed.

 

Response (about return values): 

          XML example (truncated):

<?xml version="1.0" encoding="UTF-8"?> 

<id_list>

     <ids>

          <id>30592818</id>

          <id>21249843</id>

          ... truncated ...

     </ids>

     <next_cursor>1288724293877798413</next_cursor>

     <previous_cursor>-1300794057949944903</previous_cursor>

</id_list>

 

Usage examples: 

cURL (about cURL):

curl http://api.twitter.com/1/friends/ids/dougw.xml?cursor=-1

curl http://api.twitter.com/1/friends/ids.xml?screen_name=dougw&cursor=-1

 

          Do you have an example to share in the language of your choice? Please share!

 

<< Back to Twitter API Documentation

 

Comments (0)

You don't have permission to comment on this page.