Create Token
curl --request POST \
--url https://api.tenbytecloud.com/v1/user-resource/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: <api-key>' \
--data billing_account_id=0 \
--data 'description=<string>' \
--data restricted=trueimport requests
url = "https://api.tenbytecloud.com/v1/user-resource/token"
payload = {
"billing_account_id": "0",
"description": "<string>",
"restricted": "true"
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({billing_account_id: '0', description: '<string>', restricted: 'true'})
};
fetch('https://api.tenbytecloud.com/v1/user-resource/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tenbytecloud.com/v1/user-resource/token"
payload := strings.NewReader("billing_account_id=0&description=%3Cstring%3E&restricted=true")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.tenbytecloud.com/v1/user-resource/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "billing_account_id=0&description=%3Cstring%3E&restricted=true"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://api.tenbytecloud.com/v1/user-resource/token")
.header("apikey", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("billing_account_id=0&description=%3Cstring%3E&restricted=true")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.tenbytecloud.com/v1/user-resource/token");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("apikey", "<api-key>");
request.AddParameter("billing_account_id", "0");
request.AddParameter("description", "<string>");
request.AddParameter("restricted", "true");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tenbytecloud.com/v1/user-resource/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "billing_account_id=0&description=%3Cstring%3E&restricted=true",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}[
{
"billing_account_id": 6,
"consumer_id": "9b68f9e5-34a5-41bb-8938-944c17e38723",
"created_at": "2018-02-22 14:24:02",
"description": "Token Description",
"id": 7,
"restricted": true,
"token": "PS2vfOCKuU52be83QZhMMndqOusfFkHr",
"user_id": 8
}
]Token
Create Token
Create new token and register it at API Gateway.
POST
/
user-resource
/
token
Create Token
curl --request POST \
--url https://api.tenbytecloud.com/v1/user-resource/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: <api-key>' \
--data billing_account_id=0 \
--data 'description=<string>' \
--data restricted=trueimport requests
url = "https://api.tenbytecloud.com/v1/user-resource/token"
payload = {
"billing_account_id": "0",
"description": "<string>",
"restricted": "true"
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({billing_account_id: '0', description: '<string>', restricted: 'true'})
};
fetch('https://api.tenbytecloud.com/v1/user-resource/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tenbytecloud.com/v1/user-resource/token"
payload := strings.NewReader("billing_account_id=0&description=%3Cstring%3E&restricted=true")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.tenbytecloud.com/v1/user-resource/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "billing_account_id=0&description=%3Cstring%3E&restricted=true"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://api.tenbytecloud.com/v1/user-resource/token")
.header("apikey", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("billing_account_id=0&description=%3Cstring%3E&restricted=true")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.tenbytecloud.com/v1/user-resource/token");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("apikey", "<api-key>");
request.AddParameter("billing_account_id", "0");
request.AddParameter("description", "<string>");
request.AddParameter("restricted", "true");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tenbytecloud.com/v1/user-resource/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "billing_account_id=0&description=%3Cstring%3E&restricted=true",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}[
{
"billing_account_id": 6,
"consumer_id": "9b68f9e5-34a5-41bb-8938-944c17e38723",
"created_at": "2018-02-22 14:24:02",
"description": "Token Description",
"id": 7,
"restricted": true,
"token": "PS2vfOCKuU52be83QZhMMndqOusfFkHr",
"user_id": 8
}
]⌘I