Admin (Tenant Management)
Create Tenant
Create Tenant
curl --request POST \
--url https://api.example.com/tenants \
--header 'Content-Type: */*' \
--data '{
"name": "redcorp",
"distribution_account_type": "DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT",
"owner_email": "[email protected]",
"owner_first_name": "Owner",
"owner_last_name": "Last",
"organization_name": "Red Corp",
"base_url": "https://redcorp-backend.sdp.org",
"sdp_ui_base_url": "https://redcorp.sdp.org"
}'import requests
url = "https://api.example.com/tenants"
payload = "{\n \"name\": \"redcorp\",\n \"distribution_account_type\": \"DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT\",\n \"owner_email\": \"[email protected]\",\n \"owner_first_name\": \"Owner\",\n \"owner_last_name\": \"Last\",\n \"organization_name\": \"Red Corp\",\n \"base_url\": \"https://redcorp-backend.sdp.org\",\n \"sdp_ui_base_url\": \"https://redcorp.sdp.org\"\n}"
headers = {"Content-Type": "*/*"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '*/*'},
body: '{\n "name": "redcorp",\n "distribution_account_type": "DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT",\n "owner_email": "[email protected]",\n "owner_first_name": "Owner",\n "owner_last_name": "Last",\n "organization_name": "Red Corp",\n "base_url": "https://redcorp-backend.sdp.org",\n "sdp_ui_base_url": "https://redcorp.sdp.org"\n}'
};
fetch('https://api.example.com/tenants', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/tenants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"name\": \"redcorp\",\n \"distribution_account_type\": \"DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT\",\n \"owner_email\": \"[email protected]\",\n \"owner_first_name\": \"Owner\",\n \"owner_last_name\": \"Last\",\n \"organization_name\": \"Red Corp\",\n \"base_url\": \"https://redcorp-backend.sdp.org\",\n \"sdp_ui_base_url\": \"https://redcorp.sdp.org\"\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: */*"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/tenants"
payload := strings.NewReader("{\n \"name\": \"redcorp\",\n \"distribution_account_type\": \"DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT\",\n \"owner_email\": \"[email protected]\",\n \"owner_first_name\": \"Owner\",\n \"owner_last_name\": \"Last\",\n \"organization_name\": \"Red Corp\",\n \"base_url\": \"https://redcorp-backend.sdp.org\",\n \"sdp_ui_base_url\": \"https://redcorp.sdp.org\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "*/*")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/tenants")
.header("Content-Type", "*/*")
.body("{\n \"name\": \"redcorp\",\n \"distribution_account_type\": \"DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT\",\n \"owner_email\": \"[email protected]\",\n \"owner_first_name\": \"Owner\",\n \"owner_last_name\": \"Last\",\n \"organization_name\": \"Red Corp\",\n \"base_url\": \"https://redcorp-backend.sdp.org\",\n \"sdp_ui_base_url\": \"https://redcorp.sdp.org\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/tenants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '*/*'
request.body = "{\n \"name\": \"redcorp\",\n \"distribution_account_type\": \"DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT\",\n \"owner_email\": \"[email protected]\",\n \"owner_first_name\": \"Owner\",\n \"owner_last_name\": \"Last\",\n \"organization_name\": \"Red Corp\",\n \"base_url\": \"https://redcorp-backend.sdp.org\",\n \"sdp_ui_base_url\": \"https://redcorp.sdp.org\"\n}"
response = http.request(request)
puts response.read_body{
"id": "840dca45-d1df-44cd-83c1-65c04235c25f",
"name": "redcorp",
"base_url": "https://redcorp-backend.sdp.org",
"sdp_ui_base_url": "https://redcorp.sdp.org",
"status": "TENANT_PROVISIONED",
"distribution_account": "GCQVDMPOEN3HHJJ64V42KUTONOXN7C6V2PSVPALEVJ7PIYOB6M3DJV7N",
"is_default": true,
"created_at": "2024-03-27T17:21:51.000Z",
"updated_at": "2024-03-27T17:21:51.000Z"
}{
"error": "Not authorized",
"extras": {
"status": 401,
"message": "Not authorized"
}
}Body
*/*
Response
Provision a new tenant
Create Tenant
curl --request POST \
--url https://api.example.com/tenants \
--header 'Content-Type: */*' \
--data '{
"name": "redcorp",
"distribution_account_type": "DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT",
"owner_email": "[email protected]",
"owner_first_name": "Owner",
"owner_last_name": "Last",
"organization_name": "Red Corp",
"base_url": "https://redcorp-backend.sdp.org",
"sdp_ui_base_url": "https://redcorp.sdp.org"
}'import requests
url = "https://api.example.com/tenants"
payload = "{\n \"name\": \"redcorp\",\n \"distribution_account_type\": \"DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT\",\n \"owner_email\": \"[email protected]\",\n \"owner_first_name\": \"Owner\",\n \"owner_last_name\": \"Last\",\n \"organization_name\": \"Red Corp\",\n \"base_url\": \"https://redcorp-backend.sdp.org\",\n \"sdp_ui_base_url\": \"https://redcorp.sdp.org\"\n}"
headers = {"Content-Type": "*/*"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '*/*'},
body: '{\n "name": "redcorp",\n "distribution_account_type": "DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT",\n "owner_email": "[email protected]",\n "owner_first_name": "Owner",\n "owner_last_name": "Last",\n "organization_name": "Red Corp",\n "base_url": "https://redcorp-backend.sdp.org",\n "sdp_ui_base_url": "https://redcorp.sdp.org"\n}'
};
fetch('https://api.example.com/tenants', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/tenants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"name\": \"redcorp\",\n \"distribution_account_type\": \"DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT\",\n \"owner_email\": \"[email protected]\",\n \"owner_first_name\": \"Owner\",\n \"owner_last_name\": \"Last\",\n \"organization_name\": \"Red Corp\",\n \"base_url\": \"https://redcorp-backend.sdp.org\",\n \"sdp_ui_base_url\": \"https://redcorp.sdp.org\"\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: */*"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/tenants"
payload := strings.NewReader("{\n \"name\": \"redcorp\",\n \"distribution_account_type\": \"DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT\",\n \"owner_email\": \"[email protected]\",\n \"owner_first_name\": \"Owner\",\n \"owner_last_name\": \"Last\",\n \"organization_name\": \"Red Corp\",\n \"base_url\": \"https://redcorp-backend.sdp.org\",\n \"sdp_ui_base_url\": \"https://redcorp.sdp.org\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "*/*")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/tenants")
.header("Content-Type", "*/*")
.body("{\n \"name\": \"redcorp\",\n \"distribution_account_type\": \"DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT\",\n \"owner_email\": \"[email protected]\",\n \"owner_first_name\": \"Owner\",\n \"owner_last_name\": \"Last\",\n \"organization_name\": \"Red Corp\",\n \"base_url\": \"https://redcorp-backend.sdp.org\",\n \"sdp_ui_base_url\": \"https://redcorp.sdp.org\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/tenants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '*/*'
request.body = "{\n \"name\": \"redcorp\",\n \"distribution_account_type\": \"DISTRIBUTION_ACCOUNT.STELLAR.DB_VAULT\",\n \"owner_email\": \"[email protected]\",\n \"owner_first_name\": \"Owner\",\n \"owner_last_name\": \"Last\",\n \"organization_name\": \"Red Corp\",\n \"base_url\": \"https://redcorp-backend.sdp.org\",\n \"sdp_ui_base_url\": \"https://redcorp.sdp.org\"\n}"
response = http.request(request)
puts response.read_body{
"id": "840dca45-d1df-44cd-83c1-65c04235c25f",
"name": "redcorp",
"base_url": "https://redcorp-backend.sdp.org",
"sdp_ui_base_url": "https://redcorp.sdp.org",
"status": "TENANT_PROVISIONED",
"distribution_account": "GCQVDMPOEN3HHJJ64V42KUTONOXN7C6V2PSVPALEVJ7PIYOB6M3DJV7N",
"is_default": true,
"created_at": "2024-03-27T17:21:51.000Z",
"updated_at": "2024-03-27T17:21:51.000Z"
}{
"error": "Not authorized",
"extras": {
"status": 401,
"message": "Not authorized"
}
}