Authentication
To generate a valid signed authorization header, use this code:
require 'time'
require 'openssl'
require 'base64'
def sign_headers(method:, endpoint:, date:)
access_id = `<ACCESS_ID>`
secret_key = `<SECRET_KEY>`
method = method.to_s.upcase
content_type = "application/json"
digest = OpenSSL::Digest.new("SHA256")
canonical_string = "#{method},#{content_type},,#{endpoint},#{date}"
signature = Base64.strict_encode64(OpenSSL::HMAC.digest(digest, secret_key, canonical_string))
"APIAuth-HMAC-SHA256 #{access_id}:#{signature}"
end
date = Time.now.utc.httpdate
endpoint = "/api/v1/distribution/artists"
signed_auth_header = sign_headers(method: :get, endpoint: endpoint, date: date)
puts signed_auth_headerMake sure to replace <ACCESS_ID> and <SECRET_KEY> with your API access key.
EVEN uses <ACCESS_ID> and <SECRET_KEY> to allow access to the API.
You can contact support@even.biz for get a Developer Access Key.
EVEN expects for the API key to be included in all API requests to the server in a header that looks like the following:
Authorization: <SIGNED_AUTHORIZATION_HEADER>
You must replace SIGNED_AUTHORIZATION_HEADER.