Last active
August 30, 2017 17:47
-
-
Save kkyouhei/c6c2a4186ede5834627b37adc5008b77 to your computer and use it in GitHub Desktop.
Instant Articles API for Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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