Facebook Graph API and Action Links
I'm trying to replicate Facebook action links with the Open Graph API. I have the following snippet:
HTTParty.post("https://graph.facebook.com/me/feed", query: { message: "...", picture: "...", access_token: "...", actions: [{ link: "htt开发者_运维百科p://google.com", name: "Example" }] })
However it is returning (and I'm not sure why):
{"error":{"type":"OAuthException","message":"(#100) The post's action links must be valid URLs."}}
Anyone have any experience with action links using the graph API?
Note that the actions array should be JSON encoded, HTTParty might not do this automatically / correctly. Try
HTTParty.post(
"https://graph.facebook.com/me/feed",
:query => {
:message => "...",
:picture => "...",
:access_token => "...",
:actions => [{ link: "http://google.com", name: "Example" }].to_json
}
)
(Assuming you have a library included that provides Array#to_json…)
精彩评论