我正在尝试使用 Open Graph API 复制 Facebook 操作链接。我有以下片段:
HTTParty.post("https://graph.facebook.com/me/feed", query: { message: "...", picture: "...", access_token: "...", actions: [{ link: "http://google.com", name: "Example" }] })
但是它正在返回(我不确定为什么):
{"error":{"type":"OAuthException","message":"(#100) The post's action links must be valid URLs."}}
有人对使用图形 API 的操作链接有任何经验吗?
最佳答案
请注意, Action 数组应该是 JSON 编码的,HTTParty 可能不会自动/正确地执行此操作。尝试
HTTParty.post(
"https://graph.facebook.com/me/feed",
:query => {
:message => "...",
:picture => "...",
:access_token => "...",
:actions => [{ link: "http://google.com", name: "Example" }].to_json
}
)
(假设您有一个提供 Array#to_json 的库……)
关于ruby - Facebook 图形 API 和操作链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6903627/