API Authentication

The Hyperglance API uses secure and simple 'HTTPS BASIC AUTH'

First you must generate an API Key.

The HGAPI uses Basic-Access-Authentication with HTTPS for secure access. This protocol requires passing an “Authorization” header which encodes the unique Key Name and Secret Key as the username and password respectively.

Many web request tools & frameworks have a simple way to generate this “Authorization” header given the username and password. However the header can also be manually constructed as follows:

  • Combine the Name and Secret Key into a single string, separated by a colon: “Name:Key”
  • Encode this string into Base64 according to the RFC-2045 specification for MIME encoding and without any line length limit. ( you can use the following commands to encode to Base64)
    #OSX & Linux
    echo -n 'Datasource:APIKey' | openssl base64

    #Windows
    powershell "[convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"Datasource:APIKey\"))"
  • Prefix the encoded string with the word Basic and a space: “Basic “
  • Supply this string as the request header named “Authorization”.

For example if the Datasource is “AcmeApp” and the API Key is “a15f3a32-77f3-4784-b10c-ff8b0587495b” then the header will be:

Authorization Basic QWNtZUFwcDphMTVmM2EzMi03N2YzLTQ3ODQtYjEwYy1mZjhiMDU4NzQ5NWI=

The authorization header must be provided in every API call made to the HGAPI.