Language

HAT along with its separate Database only gets created when Milliner is instructed to do so via an authenticated request.

The three key parameters for creating a HAT include:

  • CLUSTER which is the name of your HAT cluster, we can use hubat.net for testinng
  • HAT_ADDRESS as the fully-qualified address of the HAT being created, such as testhat.hubat.net
  • SECRET sent in the X-Auth-Token header - the shared secret you have been given to authenticate with Milliner. For the hubat.net testing cluster the value is currently sd3_i*w7dv-#eobog)vr*iw%ht@7fw(=dc=uv4=m3bzq69sf_9

Note: You should never expose SECRET publicly, and hence never do provisioning purely from a frontend service.

curl --request GET \
  --url https://cluster/api/manage/hat/create/HAT_ADDRESS \
  --header 'content-type: application/json' \
  --header 'x-auth-token: SECRET'
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://cluster/api/manage/hat/create/HAT_ADDRESS");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("x-auth-token", "SECRET");

xhr.send(data);
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://cluster/api/manage/hat/create/HAT_ADDRESS",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "content-type: application/json",
    "x-auth-token: SECRET"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "https://cluster/api/manage/hat/create/HAT_ADDRESS"

headers = {
    'content-type': "application/json",
    'x-auth-token': "SECRET"
    }

response = requests.request("GET", url, headers=headers)

print(response.text)
require 'uri'
require 'net/http'

url = URI("https://cluster/api/manage/hat/create/HAT_ADDRESS")

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["x-auth-token"] = 'SECRET'

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