Instagram 评论 API 无法添加“文本”价值
我请求的 URL 是 https://api.instagram.com/v1/media/MYMEDIA_ID/comments?access_token=MYTOKEN&text=MYTEXT
我得到这样的回复:
{
meta = {
code = 400;
"error_message" = "Missing 'text'";
"error_type" = APIInvalidParametersError;
};
}
在 Instagram 文档中,它说评论 API 需要两个参数:text
和 access_token
。我已经提供了两者,但收到错误消息,指出 text
丢失。
我尝试过使用不同的符号而不是 &
但没有任何效果。有人知道 text
参数应如何出现在请求的 URL 上吗?
多谢 !
My requested URL is https://api.instagram.com/v1/media/MYMEDIA_ID/comments?access_token=MYTOKEN&text=MYTEXT
I get a reply like this:
{
meta = {
code = 400;
"error_message" = "Missing 'text'";
"error_type" = APIInvalidParametersError;
};
}
In the Instagram document it says the comment API takes two parameters: text
and access_token
. I have provided both, and I get the error saying text
is missing.
I have tried with different symbols instead of &
but nothing works. Does anybody have experience on how the text
parameter should appear on the requested URL?
Thanks a lot !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我正在使用hybridauth,这是代码,它正在工作..
i am using hybridauth, and here is the code, it is working..
要向 Instagram 添加评论,您需要发布文本,该文本不应成为 URL 的一部分。 Instagram API 文档提供了一个使用 CURL 的示例:
因此 access_token 或文本都不是 URL 的一部分,只是 POST 数据。
To add comments to Instagram you need to post the text it shouldn't be part of the URL. The Instagram API documentation provides an example using CURL:
So neither the access_token or the text are part of the URL just POST data.
只需将 text=MYTEXT 添加到请求的 HTTPBody 中即可。
这是示例代码:
Just add text=MYTEXT to your request's HTTPBody.
Here is sample code:
您需要更改请求的内容类型 ContentType="comment"
you need to change the content type of the request ContentType="comment"
我相信这里的关键是 ContentType 标头。至少在我开始定义它之前,没有什么对我有用。
如果您设置 "ContentType": "multipart/form-data" 您需要设置相当复杂的正文内容,如下所述:
https://dotnetthoughts.net/post-requests-from-azure-logic -apps/
我发现更简单的路径:
设置标头 "Content-Type": "application/x-www-form-urlencoded"
,然后您可以将请求正文设置为简单的 key=url_escaped(value):
文字=我的%20评论
I believe the key here is ContentType header. At least nothing worked for me until I started to define it.
If you set "ContentType": "multipart/form-data" you need to set up quite a complex body content as described here:
https://dotnetthoughts.net/post-requests-from-azure-logic-apps/
I found much easier path:
Set your header "Content-Type": "application/x-www-form-urlencoded"
and then you can set your request body as simple as key=url_escaped(value):
text=My%20comment