Post 推特状态 url 使用推特 REST API 1.1

Post twitter status with url using twitter REST API 1.1

我正在尝试 post 从网站到 Twitter 帐户的状态并成功使用 https://api.twitter.com/1.1/statuses/update.json API and with the help of this link

当我尝试在 twitter 上向 post 添加另一个参数 URL,例如状态中包含的 &url= http://t.co/ReadMore&expended_url=https://www.google.com 时,出现错误:

The remote server returned an error: (401) Unauthorized.

谁能指导我如何添加 URL 状态参数?找了很多都没有成功。

如果您查看 API documentation for that endpoint,您会发现它不接受任意参数。唯一允许的参数是 statusin_reply_to_status_idpossibly_sensitivelatlongplace_iddisplay_coordinatestrim_usermedia_ids。如果您想添加 url 作为推文的一部分,您需要对其进行编码并将其包含在 "status" 参数中。