Twitter API:允许接受请求遵循经过身份验证的用户

时间:2011-03-11 09:48:13

标签: php api twitter

由于显示年龄限制的内容,我有一个受保护的Twitter帐户。有没有办法使用Twitter API接受或拒绝遵循此帐户的请求。我知道我可以使用

查看这些请求
  

http://api.twitter.com/version/friendships/incoming.json

但哪个请求会接受请求。我在看

  

http://api.twitter.com/version/friendships/create.json

请求,但此接缝跟随用户而不是接受他们跟随我的请求。

2 个答案:

答案 0 :(得分:4)

知道Twitter网站使用它自己的API来支持它,使用虚拟账户(@komski和@GdRd)向另一个发送跟随请求,并点击接受按钮...... Twitter发送了HTTP POST请求:

http://api.twitter.com/1/friendships/accept.json

使用以下参数:

user_id: 18828908
post_authenticity_token: cbb345597daaa0d7b3cce63e4d3014818be75627

响应是新关注者的JSON对象:

{"following":true,"profile_sidebar_fill_color":"DDEEF6","id_str":"18828908","profile_background_tile":false,"profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1194797142\/Book-Cover-question2-150x150_1__normal.jpg","description":"@reply\/mention me in message and a book's ISBN and I'll reply back it's Goodreads.com rating!","status":{"text":"@komski The Time Traveler's Wife is rated 3.94 stars by 8966 people via @goodreads","id_str":"19777104837087232","truncated":false,"source":"\u003Ca href=\"http:\/\/sudocode.net\/apps\/post-pig\" rel=\"nofollow\"\u003EPost Pig\u003C\/a\u003E","geo":null,"favorited":false,"created_at":"Tue Dec 28 15:30:03 +0000 2010","place":null,"in_reply_to_screen_name":"komski","in_reply_to_user_id":14653828,"in_reply_to_status_id":19775098961526784,"in_reply_to_status_id_str":"19775098961526784","coordinates":null,"contributors":null,"retweeted":false,"id":19777104837087232,"in_reply_to_user_id_str":"14653828","retweet_count":0},"is_translator":false,"contributors_enabled":false,"url":"http:\/\/sudocode.net\/projects\/book-ratings-twitter-bot\/","show_all_inline_media":false,"follow_request_sent":false,"geo_enabled":false,"profile_link_color":"0084B4","followers_count":69,"screen_name":"GdRd","friends_count":81,"profile_sidebar_border_color":"C0DEED","location":"The Internet","lang":"en","statuses_count":29,"verified":false,"notifications":false,"profile_use_background_image":true,"created_at":"Sat Jan 10 06:38:09 +0000  2009","listed_count":5,"profile_background_color":"C0DEED","protected":false,"profile_background_image_url":"http:\/\/a3.twimg.com\/a\/1298664727\/images\/themes\/theme1\/bg.png","favourites_count":0,"name":"GdRd","id":18828908,"time_zone":"Taipei","utc_offset":28800,"profile_text_color":"333333"}

现在,我假设在使用OAuth时,您可以尝试在发送请求时省略post_authenticity_token

答案 1 :(得分:2)

不幸的是,目前还没有使用API​​的方法。

http://code.google.com/p/twitter-api/issues/detail?id=8有一个请求,但似乎优先级很低。