Skip to content

Instantly share code, notes, and snippets.

@kkyouhei
Last active August 30, 2017 17:47
Show Gist options
  • Save kkyouhei/c6c2a4186ede5834627b37adc5008b77 to your computer and use it in GitHub Desktop.
Save kkyouhei/c6c2a4186ede5834627b37adc5008b77 to your computer and use it in GitHub Desktop.
Instant Articles API for Ruby
require 'net/http'
page_id = "your page id"
access_token = "your access token"
html_source = "your html content"
uri = URI.parse("https://graph.facebook.com/v2.6/#{page_id}/instant_articles")
request = Net::HTTP::Post.new(uri.path)
request.set_form_data({
access_token: access_token,
html_source: html_source,
development_mode: true,
published: false,
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.start do |h|
response = h.request(request)
p response.body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment