POST friendships/create

Updated on Wed, 2012-09-05 11:30

Allows the authenticating users to follow the user specified in the ID parameter.

Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. If you are already friends with the user a HTTP 403 may be returned, though for performance reasons you may get a 200 OK message even if the friendship already exists.

Actions taken in this method are asynchronous and changes will be eventually consistent.

Resource URL

https://api.twitter.com/1.1/friendships/create.json

Parameters

Providing either screen_name or user_id is required.

screen_name optional

The screen name of the user for whom to befriend.

Example Values: noradio

user_id optional

The ID of the user for whom to befriend.

Example Values: 12345

follow optional

Enable notifications for the target user.

Example Values: true

Example Request

POST

https://api.twitter.com/1.1/friendships/create.json

POST Data

user_id=1401881&follow=true

  1. {
  2.   "name": "Doug Williams",
  3.   "profile_sidebar_border_color": "87BC44",
  4.   "profile_sidebar_fill_color": "F2F8FC",
  5.   "profile_background_tile": false,
  6.   "created_at": "Sun Mar 18 06:42:26 +0000 2007",
  7.   "profile_image_url": "http://a0.twimg.com/profile_images/1947332700/dougw_avatar_can2_normal.jpg",
  8.   "location": "San Francisco, CA",
  9.   "profile_link_color": "0000FF",
  10.   "follow_request_sent": false,
  11.   "is_translator": false,
  12.   "id_str": "1401881",
  13.   "entities": {
  14.     "description": {
  15.       "urls": [
  16.  
  17.       ]
  18.     }
  19.   },
  20.   "default_profile": false,
  21.   "url": null,
  22.   "favourites_count": 2620,
  23.   "contributors_enabled": true,
  24.   "utc_offset": -28800,
  25.   "id": 1401881,
  26.   "profile_image_url_https": "https://si0.twimg.com/profile_images/1947332700/dougw_avatar_can2_normal.jpg",
  27.   "listed_count": 890,
  28.   "profile_use_background_image": true,
  29.   "profile_text_color": "000000",
  30.   "protected": false,
  31.   "lang": "en",
  32.   "followers_count": 306557,
  33.   "geo_enabled": true,
  34.   "time_zone": "Pacific Time (US & Canada)",
  35.   "notifications": false,
  36.   "verified": false,
  37.   "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/2752608/twitter_bg_grass.jpg",
  38.   "profile_background_color": "9AE4E8",
  39.   "description": "Partnerships at @twitter",
  40.   "profile_background_image_url": "http://a0.twimg.com/profile_background_images/2752608/twitter_bg_grass.jpg",
  41.   "friends_count": 1284,
  42.   "statuses_count": 11873,
  43.   "default_profile_image": false,
  44.   "status": {
  45.     "coordinates": null,
  46.     "truncated": false,
  47.     "created_at": "Sun Aug 26 21:58:35 +0000 2012",
  48.     "favorited": false,
  49.     "id_str": "239844310982459392",
  50.     "entities": {
  51.       "urls": [
  52.  
  53.       ],
  54.       "media": [
  55.         {
  56.           "media_url_https": "https://p.twimg.com/A1QZIU3CAAAnCkS.jpg",
  57.           "expanded_url": "http://twitter.com/dougw/status/239844310982459392/photo/1",
  58.           "sizes": {
  59.             "large": {
  60.               "w": 816,
  61.               "resize": "fit",
  62.               "h": 612
  63.             },
  64.             "medium": {
  65.               "w": 600,
  66.               "resize": "fit",
  67.               "h": 450
  68.             },
  69.             "small": {
  70.               "w": 340,
  71.               "resize": "fit",
  72.               "h": 255
  73.             },
  74.             "thumb": {
  75.               "w": 150,
  76.               "resize": "crop",
  77.               "h": 150
  78.             }
  79.           },
  80.           "id_str": "239844310986653696",
  81.           "url": "http://t.co/1uG4mhaB",
  82.           "id": 239844310986653696,
  83.           "type": "photo",
  84.           "indices": [
  85.             45,
  86.             65
  87.           ],
  88.           "media_url": "http://p.twimg.com/A1QZIU3CAAAnCkS.jpg",
  89.           "display_url": "pic.twitter.com/1uG4mhaB"
  90.         }
  91.       ],
  92.       "hashtags": [
  93.  
  94.       ],
  95.       "user_mentions": [
  96.  
  97.       ]
  98.     },
  99.     "in_reply_to_user_id_str": null,
  100.     "text": "Warm day by the Bay. Watching boats sail by. http://t.co/1uG4mhaB",
  101.     "contributors": null,
  102.     "id": 239844310982459392,
  103.     "retweet_count": 0,
  104.     "in_reply_to_status_id_str": null,
  105.     "geo": null,
  106.     "retweeted": false,
  107.     "in_reply_to_user_id": null,
  108.     "possibly_sensitive": false,
  109.     "place": null,
  110.     "possibly_sensitive_editable": true,
  111.     "source": "<a href=\"http://www.apple.com\" rel=\"nofollow\">Camera on iOS</a>",
  112.     "in_reply_to_screen_name": null,
  113.     "in_reply_to_status_id": null
  114.   },
  115.   "show_all_inline_media": true,
  116.   "screen_name": "dougw",
  117.   "following": true
  118. }