Skip to main content

Apito REST API Integration with Ruby Project

Net/HTTP is a default Ruby class. It is most of the time used along with URI.

note

Always remember to replace API_SECRET of the Bearer Token and project-id of the URL with the correct value from apito console. Go to this page if you do not know where to find your api secrets and endpoints for your project

require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.apito.io/secured/rest/project")

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["content-type"] = 'application/json'
request["authorization"] = 'Bearer API_SECRET'

response = http.request(request)
puts response.read_body