package hello.world;
import java.lang.Exception;
import java.util.List;
import org.openapis.openapi.AriesJava;
import org.openapis.openapi.models.errors.ErrorResponse;
import org.openapis.openapi.models.operations.CreateApiClientRequest;
import org.openapis.openapi.models.operations.CreateApiClientResponse;
public class Application {
public static void main(String[] args) throws ErrorResponse, Exception {
AriesJava sdk = AriesJava.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
CreateApiClientRequest req = CreateApiClientRequest.builder()
.name("<value>")
.scopes(List.of(
"<value 1>"))
.redirectUris(List.of(
"<value 1>",
"<value 2>"))
.build();
CreateApiClientResponse res = sdk.clients().create()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}curl --request POST \
--url https://api.tradearies.dev/v1/users/api/clients \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"<string>"
],
"redirect_uris": [
"<string>"
],
"domains": [
"<string>"
]
}
'import requests
url = "https://api.tradearies.dev/v1/users/api/clients"
payload = {
"name": "<string>",
"scopes": ["<string>"],
"redirect_uris": ["<string>"],
"domains": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
scopes: ['<string>'],
redirect_uris: ['<string>'],
domains: ['<string>']
})
};
fetch('https://api.tradearies.dev/v1/users/api/clients', 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.tradearies.dev/v1/users/api/clients",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'scopes' => [
'<string>'
],
'redirect_uris' => [
'<string>'
],
'domains' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.tradearies.dev/v1/users/api/clients"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uris\": [\n \"<string>\"\n ],\n \"domains\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.tradearies.dev/v1/users/api/clients")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uris\": [\n \"<string>\"\n ],\n \"domains\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"client_id": "<string>",
"client_secret": "<string>",
"name": "<string>",
"scopes": [
"<string>"
],
"redirect_uris": [
"<string>"
],
"domains": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"codes": [
{
"code": "<string>",
"description": "<string>"
}
]
}Create OAuth2 Client
Creates a new OAuth2 API client for the authenticated user. This endpoint allows authenticated users to create OAuth2 clients for their applications. The client will be associated with the authenticated user and can be used to implement OAuth2 authorization flows. The created client will include a client_id and client_secret that should be securely stored by the user. The client_secret cannot be retrieved again after creation. The client supports custom scopes to define permissions, multiple redirect URIs for OAuth2 authorization callbacks, and optional domain restrictions for enhanced security.
package hello.world;
import java.lang.Exception;
import java.util.List;
import org.openapis.openapi.AriesJava;
import org.openapis.openapi.models.errors.ErrorResponse;
import org.openapis.openapi.models.operations.CreateApiClientRequest;
import org.openapis.openapi.models.operations.CreateApiClientResponse;
public class Application {
public static void main(String[] args) throws ErrorResponse, Exception {
AriesJava sdk = AriesJava.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
CreateApiClientRequest req = CreateApiClientRequest.builder()
.name("<value>")
.scopes(List.of(
"<value 1>"))
.redirectUris(List.of(
"<value 1>",
"<value 2>"))
.build();
CreateApiClientResponse res = sdk.clients().create()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}curl --request POST \
--url https://api.tradearies.dev/v1/users/api/clients \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"<string>"
],
"redirect_uris": [
"<string>"
],
"domains": [
"<string>"
]
}
'import requests
url = "https://api.tradearies.dev/v1/users/api/clients"
payload = {
"name": "<string>",
"scopes": ["<string>"],
"redirect_uris": ["<string>"],
"domains": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
scopes: ['<string>'],
redirect_uris: ['<string>'],
domains: ['<string>']
})
};
fetch('https://api.tradearies.dev/v1/users/api/clients', 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.tradearies.dev/v1/users/api/clients",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'scopes' => [
'<string>'
],
'redirect_uris' => [
'<string>'
],
'domains' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.tradearies.dev/v1/users/api/clients"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uris\": [\n \"<string>\"\n ],\n \"domains\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.tradearies.dev/v1/users/api/clients")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uris\": [\n \"<string>\"\n ],\n \"domains\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"client_id": "<string>",
"client_secret": "<string>",
"name": "<string>",
"scopes": [
"<string>"
],
"redirect_uris": [
"<string>"
],
"domains": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"codes": [
{
"code": "<string>",
"description": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Response
Client created successfully
OAuth2 client ID
OAuth2 client secret (shown only once)
Client name
List of allowed scopes
List of allowed redirect URIs
List of allowed domains
Client creation timestamp
Client last update timestamp
Was this page helpful?