GET friends/ids

Updated on Sat, 2012-08-25 08:40

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

This method is powerful when used in conjunction with users/lookup.

Resource URL

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

Parameters

Either a screen_name or a user_id should be provided.

user_id optional

The ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.

Example Values: 12345

Note:: Specifies the ID of the user to befriend. Helpful for disambiguating when a valid user ID is also a valid screen name.

screen_name optional

The screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.

Example Values: noradio

cursor optional

Causes the list of connections to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 as suspended users are filtered out after connections are queried.

To begin paging provide a value of -1 as the cursor. The response from the API will include a previous_cursor and next_cursor to allow paging back and forth.

If the cursor is not provided the API will attempt to return all IDs. For users with many connections this will probably fail. Querying without the cursor parameter is deprecated and should be avoided. The API is being updated to force the cursor to be -1 if it isn't supplied.

Example Values: 12893764510938

stringify_ids optional

Many programming environments will not consume our Tweet ids due to their size. Provide this option to have ids returned as strings instead. More about Snowflake.

Example Values: true

Extended description

The URL pattern /version/friends/ids.format?id=:screen_name_or_user_id is still accepted but not recommended. As a sequence of numbers is a valid screen name we recommend using the screen_name or user_id parameter instead.

Example Request

GET

https://api.twitter.com/1/friends/ids.json?cursor=-1&screen_name=twitterapi

  1. {
  2.   "previous_cursor": 0,
  3.   "ids": [
  4.     143206502,
  5.     143201767,
  6.     777925
  7.   ],
  8.   "previous_cursor_str": "0",
  9.   "next_cursor": 0,
  10.   "next_cursor_str": "0"
  11. }