...
Send an API key to the request as a bearer token in the Authorization header. Each unit will share an API key (see ENV['YPM_SECRET'] in the code below) with ITS.
A curl example:
Code Block |
---|
curl -O -H 'Authorization: Bearer TOKEN' 'http://images-dev.collections.yale.edu/iiif/2/ypm:85f1f218-30c1-48a4-8546-17d681f59c35.tif/full/20,/0/default.jpg' |
An example in Ruby for creating the request:
Code Block | ||
---|---|---|
| ||
require 'net/http' uri = URI('http://images-dev.collections.yale.edu/iiif/2/ypm:85f1f218-30c1-48a4-8546-17d681f59c35.tif/full/20,/0/default.jpg') api_key = ENV['YPM_SECRET'] req = Net::HTTP::Get.new(uri) req['Authorization'] = "Bearer #{api_key}" res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http| http.request(req) end open('out.jpg', 'w') do |f| f.write(res.read_body) end |
...