开发者

Facebook Graph API and Action Links

开发者 https://www.devze.com 2023-03-25 00:50 出处:网络
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: \"...\",

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…)

0

精彩评论

暂无评论...
验证码 换一张
取 消