php - 推特 API : Allow accept request to follow authenticated user

标签 php api twitter

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

查看这些请求

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

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

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

请求但这接缝是为了关注用户而不是接受让他们关注我的请求。

最佳答案

知道 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

关于php - 推特 API : Allow accept request to follow authenticated user,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5271340/

相关文章:

android - 具有改造功能的Android中的YouTube数据API

php - 从外部 API 在 WooCommerce 中发布和更新 JSON 数据

java - 如何在 Kotlin 中从 Android 应用程序发送文本和图像?

javascript - 如何在 Node.js 上使用 twitter api 时实现回调函数

php - 在php中解密密码

php - 白色日期和两个变量的问题

php - 嵌套集模型是否适用于具有多个类别(多对多)的文章?

javascript - 如何获取mp3文件的大小和持续时间?

python - 如何使用 python Bottle 框架创建 REST API 应用程序以及如何将其部署到 apache 服务器上?

json - Twitter JSON 到 Google Spreadsheet API - 1. 导入和读取 JSON 文件