Language

To sign a user up, you should submit their details to Milliner. For testing you are welcome to use the development cluster at https://hubat.net, but becoming a HAT Service Provider you will be issued with a separate address.

curl --request POST \
  --url https://hubat.net/api/signup \
  --header 'content-type: application/json' \
  --data '{"fullName":"Name LastName","username":"testhat","email":"email@example.com","pass":"very-strong-password","passRepeat":"very-strong-password"}'
var data = JSON.stringify({
  "fullName": "Name LastName",
  "username": "testhat",
  "email": "email@example.com",
  "pass": "very-strong-password",
  "passRepeat": "very-strong-password"
});

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

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

xhr.open("POST", "https://hubat.net/api/signup");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://hubat.net/api/signup",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"fullName\":\"Name LastName\",\"username\":\"testhat\",\"email\":\"email@example.com\",\"pass\":\"very-strong-password\",\"passRepeat\":\"very-strong-password\"}",
  CURLOPT_HTTPHEADER => array(
    "content-type: application/json"
  ),
));

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

curl_close($curl);

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

url = "https://hubat.net/api/signup"

payload = "{\"fullName\":\"Name LastName\",\"username\":\"testhat\",\"email\":\"email@example.com\",\"pass\":\"very-strong-password\",\"passRepeat\":\"very-strong-password\"}"
headers = {'content-type': 'application/json'}

response = requests.request("POST", url, data=payload, headers=headers)

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

url = URI("https://hubat.net/api/signup")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"fullName\":\"Name LastName\",\"username\":\"testhat\",\"email\":\"email@example.com\",\"pass\":\"very-strong-password\",\"passRepeat\":\"very-strong-password\"}"

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

If signing up is successful, you will receive a simple response:


HTTP/1.1 200 
Content-Type: application/json


{
  "status": "OK",
  "message": "Signup for testhat saved"
}

Alternatively, the response will signal an error through HTTP response status and contain detail as to the nature of the error in the message body


HTTP/1.1 400 Bad Request
Content-Type: application/json


{
  "message": "Invalid username",
  "cause": "Username must not contain spaces, uppercase letters or special characters, 22 characters maximum"
}


HTTP/1.1 400 Bad Request
Content-Type: application/json


{
  "message": "Duplicate Signup",
  "cause": "HAT with such username or email already exists"
}