【问题标题】:Post twitter status with url using twitter REST API 1.1 [closed]使用 twitter REST API 1.1 通过 url 发布 twitter 状态 [关闭]
【发布时间】:2015-06-12 01:02:41
【问题描述】:

我正在尝试将状态从网站发布到 Twitter 帐户,并成功使用 https://api.twitter.com/1.1/statuses/update.json API 和 link 的帮助。

当我尝试添加另一个参数 URL (例如 &url= http://t.co/ReadMore&expended_url=https://www.google.com 包含在状态中以在 Twitter 上发布时,它会给出错误:

远程服务器返回错误:(401) Unauthorized.

有人可以指导我如何添加带有状态的 URL 参数吗?我搜索了很多,但没有成功。

【问题讨论】:

  • 处理实际的 Twitter API 可能会很棘手,使用诸如 tweetinvi 之类的库会让您的生活更轻松
  • @Coder1409:我知道,但这是一种实际的工作方式。感谢您的评论。

标签: c# asp.net-mvc twitter asp.net-web-api


【解决方案1】:

如果您查看API documentation for that endpoint,您会发现它不接受任意参数。唯一允许的参数是status、in_reply_to_status_id、possibly_sensitive、lat、long、place_id、display_coordinates、trim_user、media_ids。如果您想在推文中添加 url,则需要对其进行编码并将其包含在“status”参数中。

【讨论】:

    猜你喜欢
    • 2013-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-11
    • 2016-05-22
    • 2013-06-11
    相关资源
    最近更新 更多