Transaction#
Resource and endpoints for transaction related operations.
Endpoints:#
POST Transaction/CreateNewIssuance UPDATED
POST Transaction/GenerateTransactionDetails#
Description:
Allows you to generate transaction details.
Only completed transactions can be generated.
Pending transaction will not be generated.
Request Body:
Example Request:✓
curl --silent --location --request POST '{{baseurl}}/api/v1/Transaction/GenerateTransactionDetails' \
--header 'Authorization: Bearer <YOUR TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"controlTransactionId": 2121
}'
#!/bin/bash
# Retrieve credentials from environment variables
CLIENT_ID="${SOLO_CLIENT_ID}"
CLIENT_SECRET="${SOLO_CLIENT_SECRET}"
# Check if credentials are set
if [ -z "$CLIENT_ID" ] || [ -z "$CLIENT_SECRET" ]; then
echo "Error: SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables must be set"
exit 1
fi
# Define the OAuth2 Token Endpoint
TOKEN_ENDPOINT="{{baseurl}}/connect/token"
# Prepare and make the token request
TOKEN_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$TOKEN_ENDPOINT" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=$CLIENT_ID" \
-d "client_secret=$CLIENT_SECRET")
# Extract HTTP status code and response body
HTTP_STATUS=$(echo "$TOKEN_RESPONSE" | tail -n 1)
RESPONSE_BODY=$(echo "$TOKEN_RESPONSE" | sed '$d')
# Handle the token response
if [ "$HTTP_STATUS" -eq 200 ]; then
# Extract the access token from the response
ACCESS_TOKEN=$(echo "$RESPONSE_BODY" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
if [ -z "$ACCESS_TOKEN" ]; then
echo "Error: Failed to extract access token from response"
exit 1
fi
echo "Successfully obtained access token"
else
echo "Error: Failed to obtain access token. HTTP Status: $HTTP_STATUS"
echo "Response: $RESPONSE_BODY"
exit 1
fi
# Define the API endpoint
API_ENDPOINT="{{baseurl}}/api/v1/Transaction/GenerateTransactionDetails"
# Make the API request
API_RESPONSE=$(curl -s -X POST "$API_ENDPOINT" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"controlTransactionId": 2121
}')
# Print the JSON response from the API
echo "API Response:"
echo "$API_RESPONSE"
import os
import requests
# Set up environment variables
client_id = os.environ.get("SOLO_CLIENT_ID")
client_secret = os.environ.get("SOLO_CLIENT_SECRET")
# Define the OAuth2 Token Endpoint
token_endpoint = "{{baseurl}}/connect/token"
# Prepare the Token Request Data
token_data = {
"grant_type": "client_credentials",
"client_id": client_id,
"client_secret": client_secret
}
# Make a POST Request to get token
token_response = requests.post(token_endpoint, data=token_data)
# Handle the Response
if token_response.status_code == 200:
access_token = token_response.json().get("access_token")
# Make the API Request
api_url = "{{baseurl}}/api/v1/Transaction/GenerateTransactionDetails"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
data = {
"controlTransactionId": 2121,
}
api_response = requests.post(api_url, headers=headers, json=data)
# Print the Response
print(api_response.json())
else:
print(f"Error retrieving token: {token_response.status_code} - {token_response.text}")
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Set up environment variables
string clientId = Environment.GetEnvironmentVariable("SOLO_CLIENT_ID");
string clientSecret = Environment.GetEnvironmentVariable("SOLO_CLIENT_SECRET");
if (string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(clientSecret))
{
Console.WriteLine("Error: SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables must be set.");
return;
}
// Define the OAuth2 token endpoint
string tokenEndpoint = "{{baseurl}}/connect/token";
using HttpClient httpClient = new HttpClient();
// Prepare the token request data
var tokenRequestData = new Dictionary<string, string>
{
{ "grant_type", "client_credentials" },
{ "client_id", clientId },
{ "client_secret", clientSecret }
};
// Make a POST request to get token
var tokenRequestContent = new FormUrlEncodedContent(tokenRequestData);
HttpResponseMessage tokenResponse = await httpClient.PostAsync(tokenEndpoint, tokenRequestContent);
string accessToken = null;
// Handle the response
if (tokenResponse.StatusCode == System.Net.HttpStatusCode.OK)
{
string tokenResponseBody = await tokenResponse.Content.ReadAsStringAsync();
JsonDocument tokenJson = JsonDocument.Parse(tokenResponseBody);
accessToken = tokenJson.RootElement.GetProperty("access_token").GetString();
}
else
{
Console.WriteLine($"Error retrieving token: {tokenResponse.StatusCode}");
string errorBody = await tokenResponse.Content.ReadAsStringAsync();
Console.WriteLine(errorBody);
return;
}
// Make the API request
string apiEndpoint = "{{baseurl}}/api/v1/Transaction/GenerateTransactionDetails";
var requestBody = new { controlTransactionId = 2121 };
var jsonContent = new StringContent(
JsonSerializer.Serialize(requestBody),
Encoding.UTF8,
"application/json");
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
HttpResponseMessage apiResponse = await httpClient.PostAsync(apiEndpoint, jsonContent);
// Print the response
string apiResponseBody = await apiResponse.Content.ReadAsStringAsync();
if (apiResponse.StatusCode == System.Net.HttpStatusCode.OK)
{
JsonDocument jsonResponse = JsonDocument.Parse(apiResponseBody);
string formattedJson = JsonSerializer.Serialize(jsonResponse, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(formattedJson);
}
else
{
Console.WriteLine($"API Error: {apiResponse.StatusCode}");
Console.WriteLine(apiResponseBody);
}
}
}
const https = require('https');
const http = require('http');
const { URL } = require('url');
// Retrieve credentials from environment variables
const clientId = process.env.SOLO_CLIENT_ID;
const clientSecret = process.env.SOLO_CLIENT_SECRET;
// Define the OAuth2 Token Endpoint
const tokenEndpoint = '{{baseurl}}/connect/token';
// Function to make HTTP requests
function makeRequest(url, options, postData = null) {
return new Promise((resolve, reject) => {
const parsedUrl = new URL(url);
const protocol = parsedUrl.protocol === 'https:' ? https : http;
const req = protocol.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
resolve({ statusCode: res.statusCode, body: data });
});
});
req.on('error', (error) => {
reject(error);
});
if (postData) {
req.write(postData);
}
req.end();
});
}
async function main() {
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// Make a POST request to get token
const tokenOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(tokenData)
}
};
try {
const tokenResponse = await makeRequest(tokenEndpoint, tokenOptions, tokenData);
// Handle the Response
if (tokenResponse.statusCode !== 200) {
console.error('Error getting token:', tokenResponse.body);
return;
}
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request
const apiUrl = '{{baseurl}}/api/v1/Transaction/GenerateTransactionDetails';
const requestBody = JSON.stringify({
"controlTransactionId": 2121
});
const apiOptions = {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(requestBody)
}
};
const apiResponse = await makeRequest(apiUrl, apiOptions, requestBody);
// Print the Response
if (apiResponse.statusCode === 200) {
const responseJson = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseJson, null, 2));
} else {
console.error('API Error:', apiResponse.statusCode, apiResponse.body);
}
} catch (error) {
console.error('Request failed:', error.message);
}
}
main();
import axios from 'axios';
const SOLO_CLIENT_ID = process.env.SOLO_CLIENT_ID;
const SOLO_CLIENT_SECRET = process.env.SOLO_CLIENT_SECRET;
const BASE_URL = '{{baseurl}}';
const TOKEN_ENDPOINT = `${BASE_URL}/connect/token`;
async function getAccessToken(): Promise<string | null> {
const tokenRequestData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: SOLO_CLIENT_ID || '',
client_secret: SOLO_CLIENT_SECRET || ''
});
try {
const response = await axios.post(TOKEN_ENDPOINT, tokenRequestData, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
if (response.status === 200) {
return response.data.access_token;
} else {
console.error('Error retrieving token:', response.status, response.statusText);
return null;
}
} catch (error) {
console.error('Error retrieving token:', error);
return null;
}
}
async function callGenerateTransactionDetails(accessToken: string): Promise<void> {
const apiEndpoint = `${BASE_URL}/api/v1/Transaction/GenerateTransactionDetails`;
try {
const requestBody = { controlTransactionId: 2121 };
const response = await axios.post(apiEndpoint, requestBody, {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
console.log(JSON.stringify(response.data, null, 2));
} catch (error) {
console.error('Error calling API:', error);
}
}
async function main(): Promise<void> {
if (!SOLO_CLIENT_ID || !SOLO_CLIENT_SECRET) {
console.error('Please set SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables');
return;
}
const accessToken = await getAccessToken();
if (accessToken) {
await callGenerateTransactionDetails(accessToken);
} else {
console.error('Failed to obtain access token');
}
}
main();
const https = require('https');
const http = require('http');
const { URL } = require('url');
// Retrieve credentials from environment variables
const clientId = process.env.SOLO_CLIENT_ID;
const clientSecret = process.env.SOLO_CLIENT_SECRET;
// Define the OAuth2 Token Endpoint
const tokenEndpoint = '{{baseurl}}/connect/token';
// Function to make HTTP requests
function makeRequest(url, options, postData = null) {
return new Promise((resolve, reject) => {
const parsedUrl = new URL(url);
const protocol = parsedUrl.protocol === 'https:' ? https : http;
const req = protocol.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
resolve({ statusCode: res.statusCode, body: data });
});
});
req.on('error', (error) => {
reject(error);
});
if (postData) {
req.write(postData);
}
req.end();
});
}
async function main() {
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// Make a POST request to get token
const tokenOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(tokenData)
}
};
try {
const tokenResponse = await makeRequest(tokenEndpoint, tokenOptions, tokenData);
// Handle the Response
if (tokenResponse.statusCode !== 200) {
console.error('Error getting token:', tokenResponse.body);
return;
}
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request
const apiUrl = '{{baseurl}}/api/v1/Transaction/GenerateTransactionDetails';
const requestBody = JSON.stringify({
"controlTransactionId": 2121
});
const apiOptions = {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(requestBody)
}
};
const apiResponse = await makeRequest(apiUrl, apiOptions, requestBody);
// Print the Response
if (apiResponse.statusCode === 200) {
const responseJson = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseJson, null, 2));
} else {
console.error('API Error:', apiResponse.statusCode, apiResponse.body);
}
} catch (error) {
console.error('Request failed:', error.message);
}
}
main();
200 Response:
{
"downloadUrl": "{{baseurl}}/api/v1/Transaction/GenerateTransactionDetails/CfDJ8G2a_F-j-rtGiUBjbT5isV1Ipqf4dR3GqLU2YxSgt48du3Ou-WqbxdXRIMvStv89lntvqfGdfX6LyQ2ZsxZ0WwFMw3wS_vPk4-yAYFAGb0J9Db4MTUzzBgXW3rWh-zWHKn0IEFZFbB1y9YZNc7Pqx60Ja_ATwXDQd4iFdYokEiPC/Diluted-Percentage.pdf/CfDJ8G2a_F-j-rtGiUBjbT5isV3Hu-jA7zMIrWfSA_7r-cX3Xf7T7H79utc9yZKwgwkaC3Ulo2Fs9kpX0MeahnEHr9HWBUmT5q9jCGVRizTQwdMrjFsCTm6RELhzi72RTLNi_hxxrJKwzMUFG80smDDvI5Y"
}
POST Transaction/CreateNewIssuance#
Description:
Allows user to create a new issuance. Returns controlTransactionId.
Request Body:
idempotencyId
is submitted again, the system will return a
409 Conflict
response.
Note
See Expanded Attributes and Options section for more details
A = Series A.
B = Series B.
C = Series C.
P = Preferred
W = Warrant.
U = Units
B = Bond
D = Debenture
M = Interests
Note
Refer to the Expanded Attributes and Options page for more info on securityType options.
N = No Restriction.
R = Rule 144.
B = Blue Sky.
A = Affiliate/Control.
S = Regulation S.
L = Lock-Up Agreement.
O = Other.
Certificate Options
N = No Restriction.
R = Rule 144.
B = Blue Sky.
A = Affiliate/Control.
S = Regulation S.
L = Lock-Up Agreement.
O = Other.
Shareholder Options
None = No specific account type.
JointTenant = Joint Tenant account.
TenantsInCommon = Tenants in Common account.
JointWithRightOfSurvivorship = Joint Account with Right of Survivorship.
Trust = Trust account.
CustodyForAMinor = Custody for a Minor account.
CustodyForTheBenefitOf = Custody for the Benefit Of account.
Individual = Individual account.
Corporation = Corporation account.
Partnership = Partnership account.
UnclaimedProperty = Unclaimed Property account.
CommunityProperty = Community Property account.
IRA = Individual Retirement Account.
ProfitSharingOrKeoghPlan = Profit Sharing or Keogh Plan account.
NomineeOrDepository = Nominee or Depository account.
SchoolsAndColleges = Schools and Colleges account.
Plan401K = 401(k) Plan account.
TransferOnDeath = Transfer on Death account.
Custodian = Custodian account.
RetirementAccounts = Retirement Accounts.
SimplifiedEmployeePension = Simplified Employee Pension account.
RothIRA = Roth IRA account.
Pensions = Pensions account.
Example Request:✓
curl --silent --location --request POST '{{baseurl}}/api/v1/Transaction/CreateNewIssuance' \
--header 'Authorization: Bearer <YOUR TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"idempotencyId": "738058275223", // NEW
"customerIssuerId": 1,
"systemControlIssuerId": 1,
"shares": 100
}'
#!/bin/bash
# Retrieve credentials from environment variables
CLIENT_ID="${SOLO_CLIENT_ID}"
CLIENT_SECRET="${SOLO_CLIENT_SECRET}"
# Check if credentials are set
if [ -z "$CLIENT_ID" ] || [ -z "$CLIENT_SECRET" ]; then
echo "Error: SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables must be set"
exit 1
fi
# Define the OAuth2 Token Endpoint
TOKEN_ENDPOINT="{{baseurl}}/connect/token"
# Prepare and make the token request
TOKEN_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$TOKEN_ENDPOINT" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=$CLIENT_ID" \
-d "client_secret=$CLIENT_SECRET")
# Extract HTTP status code and response body
HTTP_STATUS=$(echo "$TOKEN_RESPONSE" | tail -n 1)
RESPONSE_BODY=$(echo "$TOKEN_RESPONSE" | sed '$d')
# Handle the token response
if [ "$HTTP_STATUS" -eq 200 ]; then
# Extract the access token from the response
ACCESS_TOKEN=$(echo "$RESPONSE_BODY" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
if [ -z "$ACCESS_TOKEN" ]; then
echo "Error: Failed to extract access token from response"
exit 1
fi
echo "Successfully obtained access token"
else
echo "Error: Failed to obtain access token. HTTP Status: $HTTP_STATUS"
echo "Response: $RESPONSE_BODY"
exit 1
fi
# Define the API endpoint
API_ENDPOINT="{{baseurl}}/api/v1/Transaction/CreateNewIssuance"
# Make the API request
API_RESPONSE=$(curl -s -X POST "$API_ENDPOINT" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"idempotencyId": "738058275223", // NEW
"customerIssuerId": 1,
"systemControlIssuerId": 1,
"shares": 100
}')
# Print the JSON response from the API
echo "API Response:"
echo "$API_RESPONSE"
import os
import requests
# Set up environment variables
client_id = os.environ.get("SOLO_CLIENT_ID")
client_secret = os.environ.get("SOLO_CLIENT_SECRET")
# Define the OAuth2 Token Endpoint
token_endpoint = "{{baseurl}}/connect/token"
# Prepare the Token Request Data
token_data = {
"grant_type": "client_credentials",
"client_id": client_id,
"client_secret": client_secret
}
# Make a POST Request to get token
token_response = requests.post(token_endpoint, data=token_data)
# Handle the Response
if token_response.status_code == 200:
access_token = token_response.json().get("access_token")
# Make the API Request
api_url = "{{baseurl}}/api/v1/Transaction/CreateNewIssuance"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
data = {
"idempotencyId": "738058275223", # NEW
"customerIssuerId": 1,
"systemControlIssuerId": 1,
"shares": 100,
}
api_response = requests.post(api_url, headers=headers, json=data)
# Print the Response
print(api_response.json())
else:
print(f"Error retrieving token: {token_response.status_code} - {token_response.text}")
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Set up environment variables
string clientId = Environment.GetEnvironmentVariable("SOLO_CLIENT_ID");
string clientSecret = Environment.GetEnvironmentVariable("SOLO_CLIENT_SECRET");
if (string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(clientSecret))
{
Console.WriteLine("Error: SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables must be set.");
return;
}
// Define the OAuth2 token endpoint
string tokenEndpoint = "{{baseurl}}/connect/token";
using HttpClient httpClient = new HttpClient();
// Prepare the token request data
var tokenRequestData = new Dictionary<string, string>
{
{ "grant_type", "client_credentials" },
{ "client_id", clientId },
{ "client_secret", clientSecret }
};
// Make a POST request to get token
var tokenRequestContent = new FormUrlEncodedContent(tokenRequestData);
HttpResponseMessage tokenResponse = await httpClient.PostAsync(tokenEndpoint, tokenRequestContent);
string accessToken = null;
// Handle the response
if (tokenResponse.StatusCode == System.Net.HttpStatusCode.OK)
{
string tokenResponseBody = await tokenResponse.Content.ReadAsStringAsync();
JsonDocument tokenJson = JsonDocument.Parse(tokenResponseBody);
accessToken = tokenJson.RootElement.GetProperty("access_token").GetString();
}
else
{
Console.WriteLine($"Error retrieving token: {tokenResponse.StatusCode}");
string errorBody = await tokenResponse.Content.ReadAsStringAsync();
Console.WriteLine(errorBody);
return;
}
// Make the API request
string apiEndpoint = "{{baseurl}}/api/v1/Transaction/CreateNewIssuance";
var requestBody = new { idempotencyId = "738058275223", customerIssuerId = 1, systemControlIssuerId = 1, shares = 100 }; // idempotencyId is NEW
var jsonContent = new StringContent(
JsonSerializer.Serialize(requestBody),
Encoding.UTF8,
"application/json");
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
HttpResponseMessage apiResponse = await httpClient.PostAsync(apiEndpoint, jsonContent);
// Print the response
string apiResponseBody = await apiResponse.Content.ReadAsStringAsync();
if (apiResponse.StatusCode == System.Net.HttpStatusCode.OK)
{
JsonDocument jsonResponse = JsonDocument.Parse(apiResponseBody);
string formattedJson = JsonSerializer.Serialize(jsonResponse, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(formattedJson);
}
else
{
Console.WriteLine($"API Error: {apiResponse.StatusCode}");
Console.WriteLine(apiResponseBody);
}
}
}
const https = require('https');
const http = require('http');
const { URL } = require('url');
// Retrieve credentials from environment variables
const clientId = process.env.SOLO_CLIENT_ID;
const clientSecret = process.env.SOLO_CLIENT_SECRET;
// Define the OAuth2 Token Endpoint
const tokenEndpoint = '{{baseurl}}/connect/token';
// Function to make HTTP requests
function makeRequest(url, options, postData = null) {
return new Promise((resolve, reject) => {
const parsedUrl = new URL(url);
const protocol = parsedUrl.protocol === 'https:' ? https : http;
const req = protocol.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
resolve({ statusCode: res.statusCode, body: data });
});
});
req.on('error', (error) => {
reject(error);
});
if (postData) {
req.write(postData);
}
req.end();
});
}
async function main() {
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// Make a POST request to get token
const tokenOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(tokenData)
}
};
try {
const tokenResponse = await makeRequest(tokenEndpoint, tokenOptions, tokenData);
// Handle the Response
if (tokenResponse.statusCode !== 200) {
console.error('Error getting token:', tokenResponse.body);
return;
}
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request
const apiUrl = '{{baseurl}}/api/v1/Transaction/CreateNewIssuance';
const requestBody = JSON.stringify({
"idempotencyId": "738058275223", // NEW
"customerIssuerId": 1,
"systemControlIssuerId": 1,
"shares": 100
});
const apiOptions = {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(requestBody)
}
};
const apiResponse = await makeRequest(apiUrl, apiOptions, requestBody);
// Print the Response
if (apiResponse.statusCode === 200) {
const responseJson = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseJson, null, 2));
} else {
console.error('API Error:', apiResponse.statusCode, apiResponse.body);
}
} catch (error) {
console.error('Request failed:', error.message);
}
}
main();
import axios from 'axios';
const SOLO_CLIENT_ID = process.env.SOLO_CLIENT_ID;
const SOLO_CLIENT_SECRET = process.env.SOLO_CLIENT_SECRET;
const BASE_URL = '{{baseurl}}';
const TOKEN_ENDPOINT = `${BASE_URL}/connect/token`;
async function getAccessToken(): Promise<string | null> {
const tokenRequestData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: SOLO_CLIENT_ID || '',
client_secret: SOLO_CLIENT_SECRET || ''
});
try {
const response = await axios.post(TOKEN_ENDPOINT, tokenRequestData, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
if (response.status === 200) {
return response.data.access_token;
} else {
console.error('Error retrieving token:', response.status, response.statusText);
return null;
}
} catch (error) {
console.error('Error retrieving token:', error);
return null;
}
}
async function callCreateNewIssuance(accessToken: string): Promise<void> {
const apiEndpoint = `${BASE_URL}/api/v1/Transaction/CreateNewIssuance`;
try {
const requestBody = { idempotencyId: "738058275223", customerIssuerId: 1, systemControlIssuerId: 1, shares: 100 }; // idempotencyId is NEW
const response = await axios.post(apiEndpoint, requestBody, {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
console.log(JSON.stringify(response.data, null, 2));
} catch (error) {
console.error('Error calling API:', error);
}
}
async function main(): Promise<void> {
if (!SOLO_CLIENT_ID || !SOLO_CLIENT_SECRET) {
console.error('Please set SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables');
return;
}
const accessToken = await getAccessToken();
if (accessToken) {
await callCreateNewIssuance(accessToken);
} else {
console.error('Failed to obtain access token');
}
}
main();
const https = require('https');
const http = require('http');
const { URL } = require('url');
// Retrieve credentials from environment variables
const clientId = process.env.SOLO_CLIENT_ID;
const clientSecret = process.env.SOLO_CLIENT_SECRET;
// Define the OAuth2 Token Endpoint
const tokenEndpoint = '{{baseurl}}/connect/token';
// Function to make HTTP requests
function makeRequest(url, options, postData = null) {
return new Promise((resolve, reject) => {
const parsedUrl = new URL(url);
const protocol = parsedUrl.protocol === 'https:' ? https : http;
const req = protocol.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
resolve({ statusCode: res.statusCode, body: data });
});
});
req.on('error', (error) => {
reject(error);
});
if (postData) {
req.write(postData);
}
req.end();
});
}
async function main() {
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// Make a POST request to get token
const tokenOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(tokenData)
}
};
try {
const tokenResponse = await makeRequest(tokenEndpoint, tokenOptions, tokenData);
// Handle the Response
if (tokenResponse.statusCode !== 200) {
console.error('Error getting token:', tokenResponse.body);
return;
}
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request
const apiUrl = '{{baseurl}}/api/v1/Transaction/CreateNewIssuance';
const requestBody = JSON.stringify({
"idempotencyId": "738058275223", // NEW
"customerIssuerId": 1,
"systemControlIssuerId": 1,
"shares": 100
});
const apiOptions = {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(requestBody)
}
};
const apiResponse = await makeRequest(apiUrl, apiOptions, requestBody);
// Print the Response
if (apiResponse.statusCode === 200) {
const responseJson = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseJson, null, 2));
} else {
console.error('API Error:', apiResponse.statusCode, apiResponse.body);
}
} catch (error) {
console.error('Request failed:', error.message);
}
}
main();
200 Response:
{
"controlTransactionId": 20886,
"customerTransactionId": null,
"displayTransactionId": 20886
}
409 Response (Duplicate Request):
{
"message": "Duplicate request detected. The idempotencyId has already been used.", // New
"idempotencyId": "738058275223" // New
}
Note
Using an existing
CustomerIssuerIdwill create a new issuance for the same issuer.Using a new
CustomerIssuerIdwill create a new issuer and a new issuance.
GET Transaction/GetTAStatusTransactions#
Description:
Allows you to get detailed information about TA Status Transactions.
Query Parameters:
All = All statuses included.
Pending = Pending status.
Rejected = Rejected status.
Completed = Completed status.
Canceled = Canceled status.
Example Request:✓
curl --silent --location '{{baseurl}}/api/v1/Transaction/GetTAStatusTransactions?CustomerIssuerId=1&SystemControlIssuerId=1' \
--header 'Authorization: Bearer <YOUR TOKEN>'
#!/bin/bash
# Retrieve credentials from environment variables
CLIENT_ID="${SOLO_CLIENT_ID}"
CLIENT_SECRET="${SOLO_CLIENT_SECRET}"
# Check if credentials are set
if [ -z "$CLIENT_ID" ] || [ -z "$CLIENT_SECRET" ]; then
echo "Error: SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables must be set"
exit 1
fi
# Define the OAuth2 Token Endpoint
TOKEN_ENDPOINT="{{baseurl}}/connect/token"
# Prepare and make the token request
TOKEN_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$TOKEN_ENDPOINT" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=$CLIENT_ID" \
-d "client_secret=$CLIENT_SECRET")
# Extract HTTP status code and response body
HTTP_STATUS=$(echo "$TOKEN_RESPONSE" | tail -n 1)
RESPONSE_BODY=$(echo "$TOKEN_RESPONSE" | sed '$d')
# Handle the token response
if [ "$HTTP_STATUS" -eq 200 ]; then
# Extract the access token from the response
ACCESS_TOKEN=$(echo "$RESPONSE_BODY" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
if [ -z "$ACCESS_TOKEN" ]; then
echo "Error: Failed to extract access token from response"
exit 1
fi
echo "Successfully obtained access token"
else
echo "Error: Failed to obtain access token. HTTP Status: $HTTP_STATUS"
echo "Response: $RESPONSE_BODY"
exit 1
fi
# Define the API endpoint
API_ENDPOINT="{{baseurl}}/api/v1/Transaction/GetTAStatusTransactions"
# Make the API request
API_RESPONSE=$(curl -s -X GET "$API_ENDPOINT?CustomerIssuerId=1&SystemControlIssuerId=1" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json")
# Print the JSON response from the API
echo "API Response:"
echo "$API_RESPONSE"
import os
import requests
# Set up environment variables
client_id = os.environ.get("SOLO_CLIENT_ID")
client_secret = os.environ.get("SOLO_CLIENT_SECRET")
# Define the OAuth2 Token Endpoint
token_endpoint = "{{baseurl}}/connect/token"
# Prepare the Token Request Data
token_data = {
"grant_type": "client_credentials",
"client_id": client_id,
"client_secret": client_secret
}
# Make a POST Request to get token
token_response = requests.post(token_endpoint, data=token_data)
# Handle the Response
if token_response.status_code == 200:
access_token = token_response.json().get("access_token")
# Make the API Request
api_url = "{{baseurl}}/api/v1/Transaction/GetTAStatusTransactions"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
params = {
"CustomerIssuerId": 1,
"SystemControlIssuerId": 1,
}
api_response = requests.get(api_url, headers=headers, params=params)
# Print the Response
print(api_response.json())
else:
print(f"Error retrieving token: {token_response.status_code} - {token_response.text}")
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Set up environment variables
string clientId = Environment.GetEnvironmentVariable("SOLO_CLIENT_ID");
string clientSecret = Environment.GetEnvironmentVariable("SOLO_CLIENT_SECRET");
if (string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(clientSecret))
{
Console.WriteLine("Error: SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables must be set.");
return;
}
// Define the OAuth2 token endpoint
string tokenEndpoint = "{{baseurl}}/connect/token";
using HttpClient httpClient = new HttpClient();
// Prepare the token request data
var tokenRequestData = new Dictionary<string, string>
{
{ "grant_type", "client_credentials" },
{ "client_id", clientId },
{ "client_secret", clientSecret }
};
// Make a POST request to get token
var tokenRequestContent = new FormUrlEncodedContent(tokenRequestData);
HttpResponseMessage tokenResponse = await httpClient.PostAsync(tokenEndpoint, tokenRequestContent);
string accessToken = null;
// Handle the response
if (tokenResponse.StatusCode == System.Net.HttpStatusCode.OK)
{
string tokenResponseBody = await tokenResponse.Content.ReadAsStringAsync();
JsonDocument tokenJson = JsonDocument.Parse(tokenResponseBody);
accessToken = tokenJson.RootElement.GetProperty("access_token").GetString();
}
else
{
Console.WriteLine($"Error retrieving token: {tokenResponse.StatusCode}");
string errorBody = await tokenResponse.Content.ReadAsStringAsync();
Console.WriteLine(errorBody);
return;
}
// Make the API request
string apiEndpoint = "{{baseurl}}/api/v1/Transaction/GetTAStatusTransactions?CustomerIssuerId=1&SystemControlIssuerId=1";
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage apiResponse = await httpClient.GetAsync(apiEndpoint);
// Print the response
string apiResponseBody = await apiResponse.Content.ReadAsStringAsync();
if (apiResponse.StatusCode == System.Net.HttpStatusCode.OK)
{
JsonDocument jsonResponse = JsonDocument.Parse(apiResponseBody);
string formattedJson = JsonSerializer.Serialize(jsonResponse, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(formattedJson);
}
else
{
Console.WriteLine($"API Error: {apiResponse.StatusCode}");
Console.WriteLine(apiResponseBody);
}
}
}
const https = require('https');
const http = require('http');
const { URL } = require('url');
// Retrieve credentials from environment variables
const clientId = process.env.SOLO_CLIENT_ID;
const clientSecret = process.env.SOLO_CLIENT_SECRET;
// Define the OAuth2 Token Endpoint
const tokenEndpoint = '{{baseurl}}/connect/token';
// Function to make HTTP requests
function makeRequest(url, options, postData = null) {
return new Promise((resolve, reject) => {
const parsedUrl = new URL(url);
const protocol = parsedUrl.protocol === 'https:' ? https : http;
const req = protocol.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
resolve({ statusCode: res.statusCode, body: data });
});
});
req.on('error', (error) => {
reject(error);
});
if (postData) {
req.write(postData);
}
req.end();
});
}
async function main() {
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// Make a POST request to get token
const tokenOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(tokenData)
}
};
try {
const tokenResponse = await makeRequest(tokenEndpoint, tokenOptions, tokenData);
// Handle the Response
if (tokenResponse.statusCode !== 200) {
console.error('Error getting token:', tokenResponse.body);
return;
}
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request
const apiUrl = '{{baseurl}}/api/v1/Transaction/GetTAStatusTransactions?CustomerIssuerId=1&SystemControlIssuerId=1';
const apiOptions = {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
};
const apiResponse = await makeRequest(apiUrl, apiOptions);
// Print the Response
if (apiResponse.statusCode === 200) {
const responseJson = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseJson, null, 2));
} else {
console.error('API Error:', apiResponse.statusCode, apiResponse.body);
}
} catch (error) {
console.error('Request failed:', error.message);
}
}
main();
import axios from 'axios';
const SOLO_CLIENT_ID = process.env.SOLO_CLIENT_ID;
const SOLO_CLIENT_SECRET = process.env.SOLO_CLIENT_SECRET;
const BASE_URL = '{{baseurl}}';
const TOKEN_ENDPOINT = `${BASE_URL}/connect/token`;
async function getAccessToken(): Promise<string | null> {
const tokenRequestData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: SOLO_CLIENT_ID || '',
client_secret: SOLO_CLIENT_SECRET || ''
});
try {
const response = await axios.post(TOKEN_ENDPOINT, tokenRequestData, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
if (response.status === 200) {
return response.data.access_token;
} else {
console.error('Error retrieving token:', response.status, response.statusText);
return null;
}
} catch (error) {
console.error('Error retrieving token:', error);
return null;
}
}
async function callGetTAStatusTransactions(accessToken: string): Promise<void> {
const apiEndpoint = `${BASE_URL}/api/v1/Transaction/GetTAStatusTransactions`;
try {
const params = { CustomerIssuerId: 1, SystemControlIssuerId: 1 };
const response = await axios.get(apiEndpoint, {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
},
params: params
});
console.log(JSON.stringify(response.data, null, 2));
} catch (error) {
console.error('Error calling API:', error);
}
}
async function main(): Promise<void> {
if (!SOLO_CLIENT_ID || !SOLO_CLIENT_SECRET) {
console.error('Please set SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables');
return;
}
const accessToken = await getAccessToken();
if (accessToken) {
await callGetTAStatusTransactions(accessToken);
} else {
console.error('Failed to obtain access token');
}
}
main();
const https = require('https');
const http = require('http');
const { URL } = require('url');
// Retrieve credentials from environment variables
const clientId = process.env.SOLO_CLIENT_ID;
const clientSecret = process.env.SOLO_CLIENT_SECRET;
// Define the OAuth2 Token Endpoint
const tokenEndpoint = '{{baseurl}}/connect/token';
// Function to make HTTP requests
function makeRequest(url, options, postData = null) {
return new Promise((resolve, reject) => {
const parsedUrl = new URL(url);
const protocol = parsedUrl.protocol === 'https:' ? https : http;
const req = protocol.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
resolve({ statusCode: res.statusCode, body: data });
});
});
req.on('error', (error) => {
reject(error);
});
if (postData) {
req.write(postData);
}
req.end();
});
}
async function main() {
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// Make a POST request to get token
const tokenOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(tokenData)
}
};
try {
const tokenResponse = await makeRequest(tokenEndpoint, tokenOptions, tokenData);
// Handle the Response
if (tokenResponse.statusCode !== 200) {
console.error('Error getting token:', tokenResponse.body);
return;
}
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request
const apiUrl = '{{baseurl}}/api/v1/Transaction/GetTAStatusTransactions?CustomerIssuerId=1&SystemControlIssuerId=1';
const apiOptions = {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
};
const apiResponse = await makeRequest(apiUrl, apiOptions);
// Print the Response
if (apiResponse.statusCode === 200) {
const responseJson = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseJson, null, 2));
} else {
console.error('API Error:', apiResponse.statusCode, apiResponse.body);
}
} catch (error) {
console.error('Request failed:', error.message);
}
}
main();
200 Response:
{
"totalRecords": 32,
"transactions": [
{
"transactionId": 1495588,
"controlTransactionId": 13682,
"type": "New Issuance",
"receivedDate": "4/27/2020",
"completedDate": "",
"effectiveDate": "4/27/2020",
"transferFrom": "",
"issuedTo": "",
"status": "Pending"
},
{
"transactionId": 1495593,
"controlTransactionId": 14686,
"type": "New Issuance",
"receivedDate": "6/4/2020",
"completedDate": "6/4/2020",
"effectiveDate": "6/4/2020",
"transferFrom": "",
"issuedTo": "Wayne Demo & Emily Demo JT TEN (200 shares)",
"status": "Completed"
}
]
}
POST Transaction/GenerateTransactions#
Description:
Allows you to generate transactions.
Query Parameters:
Empty = All Transactions.
N = New Issuances.
T = Transfers.
C = Conversions.
R = Retirements.
F = Forward Split.
V = Reverse Split.
D = Dividends.
Example Request:✓
curl --silent --location --request POST '{{baseurl}}/api/v1/Transaction/GenerateTransactions' \
--header 'Authorization: Bearer <YOUR TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"customerIssuerId": 1,
"systemControlIssuerId": 1
}'
#!/bin/bash
# Retrieve credentials from environment variables
CLIENT_ID="${SOLO_CLIENT_ID}"
CLIENT_SECRET="${SOLO_CLIENT_SECRET}"
# Check if credentials are set
if [ -z "$CLIENT_ID" ] || [ -z "$CLIENT_SECRET" ]; then
echo "Error: SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables must be set"
exit 1
fi
# Define the OAuth2 Token Endpoint
TOKEN_ENDPOINT="{{baseurl}}/connect/token"
# Prepare and make the token request
TOKEN_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$TOKEN_ENDPOINT" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=$CLIENT_ID" \
-d "client_secret=$CLIENT_SECRET")
# Extract HTTP status code and response body
HTTP_STATUS=$(echo "$TOKEN_RESPONSE" | tail -n 1)
RESPONSE_BODY=$(echo "$TOKEN_RESPONSE" | sed '$d')
# Handle the token response
if [ "$HTTP_STATUS" -eq 200 ]; then
# Extract the access token from the response
ACCESS_TOKEN=$(echo "$RESPONSE_BODY" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
if [ -z "$ACCESS_TOKEN" ]; then
echo "Error: Failed to extract access token from response"
exit 1
fi
echo "Successfully obtained access token"
else
echo "Error: Failed to obtain access token. HTTP Status: $HTTP_STATUS"
echo "Response: $RESPONSE_BODY"
exit 1
fi
# Define the API endpoint
API_ENDPOINT="{{baseurl}}/api/v1/Transaction/GenerateTransactions"
# Make the API request
API_RESPONSE=$(curl -s -X POST "$API_ENDPOINT" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"customerIssuerId": 1,
"systemControlIssuerId": 1
}')
# Print the JSON response from the API
echo "API Response:"
echo "$API_RESPONSE"
import os
import requests
# Set up environment variables
client_id = os.environ.get("SOLO_CLIENT_ID")
client_secret = os.environ.get("SOLO_CLIENT_SECRET")
# Define the OAuth2 Token Endpoint
token_endpoint = "{{baseurl}}/connect/token"
# Prepare the Token Request Data
token_data = {
"grant_type": "client_credentials",
"client_id": client_id,
"client_secret": client_secret
}
# Make a POST Request to get token
token_response = requests.post(token_endpoint, data=token_data)
# Handle the Response
if token_response.status_code == 200:
access_token = token_response.json().get("access_token")
# Make the API Request
api_url = "{{baseurl}}/api/v1/Transaction/GenerateTransactions"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
data = {
"customerIssuerId": 1,
"systemControlIssuerId": 1,
}
api_response = requests.post(api_url, headers=headers, json=data)
# Print the Response
print(api_response.json())
else:
print(f"Error retrieving token: {token_response.status_code} - {token_response.text}")
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Set up environment variables
string clientId = Environment.GetEnvironmentVariable("SOLO_CLIENT_ID");
string clientSecret = Environment.GetEnvironmentVariable("SOLO_CLIENT_SECRET");
if (string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(clientSecret))
{
Console.WriteLine("Error: SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables must be set.");
return;
}
// Define the OAuth2 token endpoint
string tokenEndpoint = "{{baseurl}}/connect/token";
using HttpClient httpClient = new HttpClient();
// Prepare the token request data
var tokenRequestData = new Dictionary<string, string>
{
{ "grant_type", "client_credentials" },
{ "client_id", clientId },
{ "client_secret", clientSecret }
};
// Make a POST request to get token
var tokenRequestContent = new FormUrlEncodedContent(tokenRequestData);
HttpResponseMessage tokenResponse = await httpClient.PostAsync(tokenEndpoint, tokenRequestContent);
string accessToken = null;
// Handle the response
if (tokenResponse.StatusCode == System.Net.HttpStatusCode.OK)
{
string tokenResponseBody = await tokenResponse.Content.ReadAsStringAsync();
JsonDocument tokenJson = JsonDocument.Parse(tokenResponseBody);
accessToken = tokenJson.RootElement.GetProperty("access_token").GetString();
}
else
{
Console.WriteLine($"Error retrieving token: {tokenResponse.StatusCode}");
string errorBody = await tokenResponse.Content.ReadAsStringAsync();
Console.WriteLine(errorBody);
return;
}
// Make the API request
string apiEndpoint = "{{baseurl}}/api/v1/Transaction/GenerateTransactions";
var requestBody = new { customerIssuerId = 1, systemControlIssuerId = 1 };
var jsonContent = new StringContent(
JsonSerializer.Serialize(requestBody),
Encoding.UTF8,
"application/json");
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
HttpResponseMessage apiResponse = await httpClient.PostAsync(apiEndpoint, jsonContent);
// Print the response
string apiResponseBody = await apiResponse.Content.ReadAsStringAsync();
if (apiResponse.StatusCode == System.Net.HttpStatusCode.OK)
{
JsonDocument jsonResponse = JsonDocument.Parse(apiResponseBody);
string formattedJson = JsonSerializer.Serialize(jsonResponse, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(formattedJson);
}
else
{
Console.WriteLine($"API Error: {apiResponse.StatusCode}");
Console.WriteLine(apiResponseBody);
}
}
}
const https = require('https');
const http = require('http');
const { URL } = require('url');
// Retrieve credentials from environment variables
const clientId = process.env.SOLO_CLIENT_ID;
const clientSecret = process.env.SOLO_CLIENT_SECRET;
// Define the OAuth2 Token Endpoint
const tokenEndpoint = '{{baseurl}}/connect/token';
// Function to make HTTP requests
function makeRequest(url, options, postData = null) {
return new Promise((resolve, reject) => {
const parsedUrl = new URL(url);
const protocol = parsedUrl.protocol === 'https:' ? https : http;
const req = protocol.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
resolve({ statusCode: res.statusCode, body: data });
});
});
req.on('error', (error) => {
reject(error);
});
if (postData) {
req.write(postData);
}
req.end();
});
}
async function main() {
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// Make a POST request to get token
const tokenOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(tokenData)
}
};
try {
const tokenResponse = await makeRequest(tokenEndpoint, tokenOptions, tokenData);
// Handle the Response
if (tokenResponse.statusCode !== 200) {
console.error('Error getting token:', tokenResponse.body);
return;
}
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request
const apiUrl = '{{baseurl}}/api/v1/Transaction/GenerateTransactions';
const requestBody = JSON.stringify({
"customerIssuerId": 1,
"systemControlIssuerId": 1
});
const apiOptions = {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(requestBody)
}
};
const apiResponse = await makeRequest(apiUrl, apiOptions, requestBody);
// Print the Response
if (apiResponse.statusCode === 200) {
const responseJson = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseJson, null, 2));
} else {
console.error('API Error:', apiResponse.statusCode, apiResponse.body);
}
} catch (error) {
console.error('Request failed:', error.message);
}
}
main();
import axios from 'axios';
const SOLO_CLIENT_ID = process.env.SOLO_CLIENT_ID;
const SOLO_CLIENT_SECRET = process.env.SOLO_CLIENT_SECRET;
const BASE_URL = '{{baseurl}}';
const TOKEN_ENDPOINT = `${BASE_URL}/connect/token`;
async function getAccessToken(): Promise<string | null> {
const tokenRequestData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: SOLO_CLIENT_ID || '',
client_secret: SOLO_CLIENT_SECRET || ''
});
try {
const response = await axios.post(TOKEN_ENDPOINT, tokenRequestData, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
if (response.status === 200) {
return response.data.access_token;
} else {
console.error('Error retrieving token:', response.status, response.statusText);
return null;
}
} catch (error) {
console.error('Error retrieving token:', error);
return null;
}
}
async function callGenerateTransactions(accessToken: string): Promise<void> {
const apiEndpoint = `${BASE_URL}/api/v1/Transaction/GenerateTransactions`;
try {
const requestBody = { customerIssuerId: 1, systemControlIssuerId: 1 };
const response = await axios.post(apiEndpoint, requestBody, {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
console.log(JSON.stringify(response.data, null, 2));
} catch (error) {
console.error('Error calling API:', error);
}
}
async function main(): Promise<void> {
if (!SOLO_CLIENT_ID || !SOLO_CLIENT_SECRET) {
console.error('Please set SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables');
return;
}
const accessToken = await getAccessToken();
if (accessToken) {
await callGenerateTransactions(accessToken);
} else {
console.error('Failed to obtain access token');
}
}
main();
const https = require('https');
const http = require('http');
const { URL } = require('url');
// Retrieve credentials from environment variables
const clientId = process.env.SOLO_CLIENT_ID;
const clientSecret = process.env.SOLO_CLIENT_SECRET;
// Define the OAuth2 Token Endpoint
const tokenEndpoint = '{{baseurl}}/connect/token';
// Function to make HTTP requests
function makeRequest(url, options, postData = null) {
return new Promise((resolve, reject) => {
const parsedUrl = new URL(url);
const protocol = parsedUrl.protocol === 'https:' ? https : http;
const req = protocol.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
resolve({ statusCode: res.statusCode, body: data });
});
});
req.on('error', (error) => {
reject(error);
});
if (postData) {
req.write(postData);
}
req.end();
});
}
async function main() {
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// Make a POST request to get token
const tokenOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(tokenData)
}
};
try {
const tokenResponse = await makeRequest(tokenEndpoint, tokenOptions, tokenData);
// Handle the Response
if (tokenResponse.statusCode !== 200) {
console.error('Error getting token:', tokenResponse.body);
return;
}
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request
const apiUrl = '{{baseurl}}/api/v1/Transaction/GenerateTransactions';
const requestBody = JSON.stringify({
"customerIssuerId": 1,
"systemControlIssuerId": 1
});
const apiOptions = {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(requestBody)
}
};
const apiResponse = await makeRequest(apiUrl, apiOptions, requestBody);
// Print the Response
if (apiResponse.statusCode === 200) {
const responseJson = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseJson, null, 2));
} else {
console.error('API Error:', apiResponse.statusCode, apiResponse.body);
}
} catch (error) {
console.error('Request failed:', error.message);
}
}
main();
200 Response:
{
"downloadUrl": "{{baseurl}}/Api/v1/Report/DownloadReport/CfDJ8G2a_F-j-rtGiUBjbT5isV0r5B9N26nYeS0oLBfQr6SGXCBI7QfYmxow2rLNGkkF2d6sJTAJ3VDwJvoEsIkuATo0SGDxYfQwRuf8y27DsDNcXprMUr5b_GVKFZKtDRYvsfgoUbrK7tHvHb9z-0ZfR-TIohcNCtiBJhYwtnBDNeld/transactions.pdf/CfDJ8G2a_F-j-rtGiUBjbT5isV3xovmq_IewIGWxZBBXzvUTkRhWMb1htMjDslWJznRFV3zS90kRVb4vnbTS3uZ7znKVI2dG6AnCoLqFxEbi60j7irw7ivfOx_QqKavtId_KRjE44k0jepjpVvArFa23Nzg"
}