InstagramのAPIを叩く

更新日:2020.03.31 作成日:2011.12.14
require 'uri'
require 'net/https'
require 'json'

url = 'https://api.instagram.com/v1/users/3/media/recent/'
access_token = YOUR_ACCESS_TOKEN
param = "access_token=#{access_token}"

uri = URI.parse(url)
https = Net::HTTP.new(uri.host,443)
https.use_ssl = true
https.start {
  response = https.get(uri.path + "?#{param}")
  json = JSON.parse(response.body)
  print json
}

Related contents