Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

call api in ruby

require 'uri'
require 'net/http'

url = URI("https://api.sygictravelapi.com/1.0/en/places/list?parents=city%3A372&level=poi&limit=100")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-api-key"] = ENV["SYGIC_API_KEY"]
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #call #api #ruby
ADD COMMENT
Topic
Name
7+2 =