我正在尝试用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的操作链接的任何经验?
注意动作数组应该是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…)