Issuer#
Resource used for managing Issuers.
Endpoints:#
GET Issuer/IssuerShareholderCapTable UPDATED
GET Issuer/IssuerShareholderDetails UPDATED
Description:
Retrieves Shareholder Cap Table for a given Issuer.
Query Parameters:
Example Request:✓
curl --silent --location '{{baseurl}}/api/v1/Issuer/shareholder/cap/table?CustomerIssuerId=1&SystemControlIssuerId=1&Start=1&NumberOfRows=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/Issuer/shareholder/cap/table"
# Make the API request to the table endpoint
API_RESPONSE=$(curl -s -X GET "$API_ENDPOINT?CustomerIssuerId=1&SystemControlIssuerId=1&Start=1&NumberOfRows=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/Issuer/shareholder/cap/table"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
params = {
"CustomerIssuerId": 1,
"SystemControlIssuerId": 1,
"Start": 1,
"NumberOfRows": 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.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/Issuer/shareholder/cap/table?CustomerIssuerId=1&SystemControlIssuerId=1&Start=1&NumberOfRows=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 to the table endpoint
const apiUrl = '{{baseurl}}/api/v1/Issuer/shareholder/cap/table?CustomerIssuerId=1&SystemControlIssuerId=1&Start=1&NumberOfRows=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 getShareholderCapTable(accessToken: string): Promise<void> {
const apiEndpoint = `${BASE_URL}/api/v1/Issuer/shareholder/cap/table`;
const params = {
CustomerIssuerId: 1,
SystemControlIssuerId: 1,
Start: 1,
NumberOfRows: 1
};
try {
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 getShareholderCapTable(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) {
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request to the table endpoint
const apiUrl = '{{baseurl}}/api/v1/Issuer/shareholder/cap/table?CustomerIssuerId=1&SystemControlIssuerId=1&Start=1&NumberOfRows=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 request failed with status code: ${apiResponse.statusCode}`);
console.error(apiResponse.body);
}
} else {
console.error(`Token request failed with status code: ${tokenResponse.statusCode}`);
console.error(tokenResponse.body);
}
} catch (error) {
console.error('Error:', error.message);
}
}
main();
200 Response:
{
"totalShareholderRecords": 1,
"shareholders": [
{
"shareholderCustomerId": "23432E",
"shareholderControlId": 13423,
"shareholderName": "John Doe",
"shareholderEmail": "johndoe@email",
"shareholderType": "Individual Retirement Account",
"shareholderTypeEnum": "IRA", // New
"securityType": "Common",
"securityTypeID": 1,
"value": 200,
"totalShares": 100,
"restrictionShares": 0,
"nonRestrictionShares": 100
}
],
"securities": [
{
"securityTypeID": 1,
"securityType": "Common",
"numberOfShareholders": 100,
"totalIssuedShares": 10000,
"authorizedShares": 2000000,
"totalValue": 2000,
"isUnlimitedAuthorizedShares": false
}
]
}
Description:
Retrieves Shareholder details for a given Issuer.
Query Parameters:
Example Request:✓
curl --silent --location '{{baseurl}}/api/v1/Issuer/shareholder/details?CustomerIssuerId=1&SystemControlIssuerId=1&CustomerShareholderId=example&SystemShareholderId=1&Start=1&NumberOfRows=1' \
--header 'Authorization: Bearer <YOUR TOKEN>'
#!/bin/bash
# Set up environment variables
CLIENT_ID="${SOLO_CLIENT_ID}"
CLIENT_SECRET="${SOLO_CLIENT_SECRET}"
# Define the OAuth2 Token Endpoint
TOKEN_ENDPOINT="{{baseurl}}/connect/token"
# Prepare the token request data and make POST request to get token
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 response
if [ "$HTTP_STATUS" -eq 200 ]; then
# Extract the access token
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 retrieved access token"
# Make the API Request to the details endpoint
API_RESPONSE=$(curl -s -X GET "{{baseurl}}/api/v1/Issuer/shareholder/details?CustomerIssuerId=1&SystemControlIssuerId=1&CustomerShareholderId=example&SystemShareholderId=1&Start=1&NumberOfRows=1" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json")
# Print the JSON response from the API
echo "API Response:"
echo "$API_RESPONSE"
else
echo "Error: Failed to retrieve access token. HTTP Status: $HTTP_STATUS"
echo "Response: $RESPONSE_BODY"
exit 1
fi
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/Issuer/shareholder/details"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
params = {
"CustomerIssuerId": 1,
"SystemControlIssuerId": 1,
"CustomerShareholderId": "example",
"SystemShareholderId": 1,
"Start": 1,
"NumberOfRows": 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.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 FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("grant_type", "client_credentials"),
new KeyValuePair<string, string>("client_id", clientId),
new KeyValuePair<string, string>("client_secret", clientSecret)
});
// Make a POST request to get token
HttpResponseMessage tokenResponse = await httpClient.PostAsync(tokenEndpoint, tokenRequestData);
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 baseUrl = "{{baseurl}}";
string apiEndpoint = $"{baseUrl}/api/v1/Issuer/shareholder/details?CustomerIssuerId=1&SystemControlIssuerId=1&CustomerShareholderId=example&SystemShareholderId=1&Start=1&NumberOfRows=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 responseBody = await apiResponse.Content.ReadAsStringAsync();
if (apiResponse.IsSuccessStatusCode)
{
try
{
JsonDocument jsonDoc = JsonDocument.Parse(responseBody);
string prettyJson = JsonSerializer.Serialize(jsonDoc, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(prettyJson);
}
catch (JsonException)
{
Console.WriteLine(responseBody);
}
}
else
{
Console.WriteLine($"API Error: {apiResponse.StatusCode}");
Console.WriteLine(responseBody);
}
}
}
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 access token:', tokenResponse.body);
return;
}
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request to the details endpoint
const apiBaseUrl = '{{baseurl}}';
const queryParams = new URLSearchParams({
CustomerIssuerId: '1',
SystemControlIssuerId: '1',
CustomerShareholderId: 'example',
SystemShareholderId: '1',
Start: '1',
NumberOfRows: '1'
}).toString();
const apiUrl = `${apiBaseUrl}/api/v1/Issuer/shareholder/details?${queryParams}`;
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> {
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: SOLO_CLIENT_ID,
client_secret: SOLO_CLIENT_SECRET,
});
try {
const response = await axios.post(TOKEN_ENDPOINT, tokenData, {
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);
throw new Error('Failed to retrieve access token');
}
} catch (error) {
console.error('Error retrieving token:', error);
throw error;
}
}
async function getIssuerShareholderDetails(accessToken: string): Promise<void> {
const apiEndpoint = `${BASE_URL}/api/v1/Issuer/shareholder/details`;
const params = {
CustomerIssuerId: 1,
SystemControlIssuerId: 1,
CustomerShareholderId: 'example',
SystemShareholderId: 1,
Start: 1,
NumberOfRows: 1,
};
try {
const response = await axios.get(apiEndpoint, {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
params: params,
});
console.log('API Response:', JSON.stringify(response.data, null, 2));
} catch (error) {
if (axios.isAxiosError(error)) {
console.error('API Error:', error.response?.status, error.response?.statusText);
console.error('Error Details:', error.response?.data);
} else {
console.error('Error:', error);
}
}
}
async function main(): Promise<void> {
try {
const accessToken = await getAccessToken();
console.log('Access token retrieved successfully');
await getIssuerShareholderDetails(accessToken);
} catch (error) {
console.error('Main execution error:', error);
}
}
main();
const https = require('https');
const http = require('http');
const { URL } = require('url');
// Set up 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';
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// 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() {
try {
// Make a POST Request to get token
const tokenResponse = await makeRequest(tokenEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}, tokenData);
// Handle the Response
if (tokenResponse.statusCode === 200) {
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request
const apiUrl = '{{baseurl}}/api/v1/Issuer/shareholder/details?CustomerIssuerId=1&SystemControlIssuerId=1&CustomerShareholderId=example&SystemShareholderId=1&Start=1&NumberOfRows=1';
const apiResponse = await makeRequest(apiUrl, {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
// Print the Response
const responseData = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseData, null, 2));
} else {
console.error('Error getting token:', tokenResponse.statusCode, tokenResponse.body);
}
} catch (error) {
console.error('Error:', error.message);
}
}
main();
200 Response:
{
"totalShareholderRecords": 1,
"shareholders": [
{
"shareholderName": "John Doe",
"shareholderEmail": "johndoe@email.com",
"shareholderType": "Individual Retirement Account",
"shareholderTypeEnum": "IRA", // New
"shareholderCustomerId": "3432472E",
"shareholderControlId": 12355,
"securities": [
{
"securityTypeId": 1,
"securityType": "Common",
"totalShares": 100,
"totalValue": 200,
"certificates": [
{
"controlCertificateId": 1234687, // New
"customerCertificateId": null, // New
"certificateNumber": "Book-2762",
"shares": 100,
"value": 200,
"issuedDate": "2024-07-10",
"issuanceTransactionId": null
}
]
}
]
}
]
}
GET Issuer/GetIssuerSecurityTypes#
Description:
Retrieves security types associated with an Issuer.
Query Parameters:
Example Request:✓
curl --silent --location '{{baseurl}}/api/v1/Issuer/GetIssuerSecurityTypes?CustomerIssuerId=1&SystemControlIssuerId=1' \
--header 'Authorization: Bearer <YOUR TOKEN>'
#!/bin/bash
# Set up environment variables (these should be set in your environment)
# export SOLO_CLIENT_ID="your_client_id"
# export SOLO_CLIENT_SECRET="your_client_secret"
# 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"
# Make a POST request to get the access token
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 the HTTP status code and response body
HTTP_STATUS=$(echo "$TOKEN_RESPONSE" | tail -n 1)
RESPONSE_BODY=$(echo "$TOKEN_RESPONSE" | sed '$d')
# Handle the 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/Issuer/GetIssuerSecurityTypes"
# Make the API request to GetIssuerSecurityTypes
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
# Retrieve credentials from environment variables
client_id = os.environ.get("SOLO_CLIENT_ID")
client_secret = os.environ.get("SOLO_CLIENT_SECRET")
# Define the OAuth2 Token Endpoint
token_url = "{{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_url, 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/Issuer/GetIssuerSecurityTypes"
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.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);
// Handle the Response
if (tokenResponse.StatusCode != System.Net.HttpStatusCode.OK)
{
Console.WriteLine($"Error: Failed to retrieve access token. Status code: {tokenResponse.StatusCode}");
string errorContent = await tokenResponse.Content.ReadAsStringAsync();
Console.WriteLine($"Response: {errorContent}");
return;
}
string tokenResponseContent = await tokenResponse.Content.ReadAsStringAsync();
JsonDocument tokenJson = JsonDocument.Parse(tokenResponseContent);
string accessToken = tokenJson.RootElement.GetProperty("access_token").GetString();
// Make the API Request
string apiBaseUrl = "{{baseurl}}";
string apiEndpoint = "/api/v1/Issuer/GetIssuerSecurityTypes";
// Build query parameters
var queryParams = new Dictionary<string, string>
{
{ "CustomerIssuerId", "1" },
{ "SystemControlIssuerId", "1" }
};
string queryString = string.Join("&", queryParams.Select(kvp => $"{kvp.Key}={Uri.EscapeDataString(kvp.Value)}"));
string fullUrl = $"{apiBaseUrl}{apiEndpoint}?{queryString}";
HttpRequestMessage apiRequest = new HttpRequestMessage(HttpMethod.Get, fullUrl);
apiRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
apiRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage apiResponse = await httpClient.SendAsync(apiRequest);
// Print the Response
string apiResponseContent = await apiResponse.Content.ReadAsStringAsync();
if (apiResponse.StatusCode == System.Net.HttpStatusCode.OK)
{
// Pretty print the JSON response
JsonDocument responseJson = JsonDocument.Parse(apiResponseContent);
string prettyJson = JsonSerializer.Serialize(responseJson, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(prettyJson);
}
else
{
Console.WriteLine($"Error: API request failed. Status code: {apiResponse.StatusCode}");
Console.WriteLine($"Response: {apiResponseContent}");
}
}
}
const https = require('https');
const querystring = require('querystring');
// Environment variables
const SOLO_CLIENT_ID = process.env.SOLO_CLIENT_ID;
const SOLO_CLIENT_SECRET = process.env.SOLO_CLIENT_SECRET;
// Token endpoint
const TOKEN_URL = '{{baseurl}}/connect/token';
const API_BASE_URL = '{{baseurl}}';
// Function to make HTTPS request
function makeRequest(url, options, postData = null) {
return new Promise((resolve, reject) => {
const req = https.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();
});
}
// Function to get access token
async function getAccessToken() {
const tokenData = querystring.stringify({
grant_type: 'client_credentials',
client_id: SOLO_CLIENT_ID,
client_secret: SOLO_CLIENT_SECRET
});
const tokenUrl = new URL(TOKEN_URL);
const options = {
hostname: tokenUrl.hostname,
path: tokenUrl.pathname,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(tokenData)
}
};
const response = await makeRequest(tokenUrl, options, tokenData);
if (response.statusCode === 200) {
const tokenResponse = JSON.parse(response.body);
return tokenResponse.access_token;
} else {
throw new Error(`Failed to get access token: ${response.statusCode} - ${response.body}`);
}
}
// Function to get issuer security types
async function getIssuerSecurityTypes(accessToken) {
const queryParams = querystring.stringify({
CustomerIssuerId: 1,
SystemControlIssuerId: 1
});
const apiUrl = new URL(`${API_BASE_URL}/api/v1/Issuer/GetIssuerSecurityTypes?${queryParams}`);
const options = {
hostname: apiUrl.hostname,
path: `${apiUrl.pathname}${apiUrl.search}`,
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
};
const response = await makeRequest(apiUrl, options);
if (response.statusCode === 200) {
return JSON.parse(response.body);
} else {
throw new Error(`API request failed: ${response.statusCode} - ${response.body}`);
}
}
// Main execution
async function main() {
try {
console.log('Retrieving access token...');
const accessToken = await getAccessToken();
console.log('Access token retrieved successfully.');
console.log('Fetching issuer security types...');
const securityTypes = await getIssuerSecurityTypes(accessToken);
console.log('Response:');
console.log(JSON.stringify(securityTypes, null, 2));
} catch (error) {
console.error('Error:', error.message);
}
}
main();
import axios from 'axios';
async function main() {
// Set up environment variables
const clientId = process.env.SOLO_CLIENT_ID;
const clientSecret = process.env.SOLO_CLIENT_SECRET;
if (!clientId || !clientSecret) {
console.error('Error: SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables must be set');
process.exit(1);
}
// Define the OAuth2 Token Endpoint
const tokenEndpoint = '{{baseurl}}/connect/token';
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret,
});
try {
// Make a POST Request to get token
const tokenResponse = await axios.post(tokenEndpoint, tokenData.toString(), {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
// Handle the Response
if (tokenResponse.status === 200) {
const accessToken = tokenResponse.data.access_token;
// Make the API Request
const apiEndpoint = '{{baseurl}}/api/v1/Issuer/GetIssuerSecurityTypes';
const apiResponse = await axios.get(apiEndpoint, {
params: {
CustomerIssuerId: 1,
SystemControlIssuerId: 1,
},
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
});
// Print the Response
console.log(JSON.stringify(apiResponse.data, null, 2));
} else {
console.error('Error: Failed to retrieve access token');
}
} catch (error) {
if (axios.isAxiosError(error)) {
console.error('Error:', error.response?.status, error.response?.data || error.message);
} else {
console.error('Error:', error);
}
}
}
main();
const https = require('https');
const querystring = require('querystring');
// Environment variables
const clientId = process.env.SOLO_CLIENT_ID;
const clientSecret = process.env.SOLO_CLIENT_SECRET;
// Token endpoint
const tokenUrl = '{{baseurl}}/connect/token';
// Function to make HTTPS request
function makeRequest(url, options, postData = null) {
return new Promise((resolve, reject) => {
const req = https.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 getAccessToken() {
const tokenData = querystring.stringify({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
});
const urlObj = new URL(tokenUrl);
const options = {
hostname: urlObj.hostname,
path: urlObj.pathname,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(tokenData)
}
};
const response = await makeRequest(tokenUrl, options, tokenData);
if (response.statusCode === 200) {
const tokenResponse = JSON.parse(response.body);
return tokenResponse.access_token;
} else {
console.error('Error getting access token:', response.body);
throw new Error('Failed to retrieve access token');
}
}
async function getIssuerSecurityTypes(accessToken) {
const baseUrl = '{{baseurl}}/api/v1/Issuer/GetIssuerSecurityTypes';
const params = new URLSearchParams({
CustomerIssuerId: '1',
SystemControlIssuerId: '1'
});
const fullUrl = `${baseUrl}?${params.toString()}`;
const urlObj = new URL(fullUrl);
const options = {
hostname: urlObj.hostname,
path: urlObj.pathname + urlObj.search,
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
};
const response = await makeRequest(fullUrl, options);
if (response.statusCode === 200) {
const jsonResponse = JSON.parse(response.body);
console.log(JSON.stringify(jsonResponse, null, 2));
return jsonResponse;
} else {
console.error('Error calling API:', response.statusCode, response.body);
throw new Error('Failed to get issuer security types');
}
}
async function main() {
try {
const accessToken = await getAccessToken();
await getIssuerSecurityTypes(accessToken);
} catch (error) {
console.error('Error:', error.message);
}
}
main();
200 Response:
[
{
"securityTypeId": 1,
"securityType": "Common",
"securityTypeCode": "C",
"securitySeriesCode": ""
},
{
"securityTypeId": 2,
"securityType": "Warrant",
"securityTypeCode": "W",
"securitySeriesCode": ""
},
{
"securityTypeId": 6,
"securityType": "Preferred",
"securityTypeCode": "P",
"securitySeriesCode": ""
}
]
GET Issuer/GetIssuerActiveCertificateDefinitions#
Description:
Provides Active Certificate definitions for an Issuer.
Query Parameters:
Example Request:✓
curl --silent --location '{{baseurl}}/api/v1/Issuer/GetIssuerActiveCertificateDefinitions?CustomerIssuerId=1&SystemControlIssuerId=1' \
--header 'Authorization: Bearer <YOUR TOKEN>'
#!/bin/bash
# Set up environment variables (these should be set in your environment)
# export SOLO_CLIENT_ID="your_client_id"
# export SOLO_CLIENT_SECRET="your_client_secret"
# 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"
# Make a POST request to get the access token
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 the HTTP status code and response body
HTTP_STATUS=$(echo "$TOKEN_RESPONSE" | tail -n 1)
RESPONSE_BODY=$(echo "$TOKEN_RESPONSE" | sed '$d')
# Handle the 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/Issuer/GetIssuerActiveCertificateDefinitions"
# Make the API request to GetIssuerActiveCertificateDefinitions
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/Issuer/GetIssuerActiveCertificateDefinitions"
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 obtaining 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.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);
// Handle the Response
if (tokenResponse.StatusCode != System.Net.HttpStatusCode.OK)
{
Console.WriteLine($"Error: Failed to retrieve access token. Status code: {tokenResponse.StatusCode}");
string errorContent = await tokenResponse.Content.ReadAsStringAsync();
Console.WriteLine($"Response: {errorContent}");
return;
}
string tokenResponseContent = await tokenResponse.Content.ReadAsStringAsync();
JsonDocument tokenJson = JsonDocument.Parse(tokenResponseContent);
string accessToken = tokenJson.RootElement.GetProperty("access_token").GetString();
// Make the API Request
string apiEndpoint = "{{baseurl}}/api/v1/Issuer/GetIssuerActiveCertificateDefinitions?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 apiResponseContent = await apiResponse.Content.ReadAsStringAsync();
if (apiResponse.StatusCode == System.Net.HttpStatusCode.OK)
{
JsonDocument responseJson = JsonDocument.Parse(apiResponseContent);
string formattedJson = JsonSerializer.Serialize(responseJson, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(formattedJson);
}
else
{
Console.WriteLine($"Error: API request failed. Status code: {apiResponse.StatusCode}");
Console.WriteLine($"Response: {apiResponseContent}");
}
}
}
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';
// Prepare the token request data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// 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() {
try {
// Make a POST request to get token
const tokenResponse = await makeRequest(tokenEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}, tokenData);
// Handle the response
if (tokenResponse.statusCode === 200) {
const tokenResult = JSON.parse(tokenResponse.body);
const accessToken = tokenResult.access_token;
// Make the API Request to GetIssuerActiveCertificateDefinitions
const apiEndpoint = '{{baseurl}}/api/v1/Issuer/GetIssuerActiveCertificateDefinitions?CustomerIssuerId=1&SystemControlIssuerId=1';
const apiResponse = await makeRequest(apiEndpoint, {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
// Print the JSON response from the API
const apiResult = JSON.parse(apiResponse.body);
console.log(JSON.stringify(apiResult, null, 2));
} else {
console.error('Error getting token:', tokenResponse.statusCode, tokenResponse.body);
}
} catch (error) {
console.error('Error:', 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 tokenEndpoint = '{{baseurl}}/connect/token';
const apiBaseUrl = '{{baseurl}}';
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(tokenEndpoint, tokenRequestData.toString(), {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
if (response.status === 200) {
return response.data.access_token;
} else {
console.error('Error retrieving access token:', response.status, response.statusText);
return null;
}
} catch (error) {
console.error('Error retrieving access token:', error);
return null;
}
}
async function getIssuerActiveCertificateDefinitions(accessToken: string): Promise<void> {
const endpoint = `${apiBaseUrl}/api/v1/Issuer/GetIssuerActiveCertificateDefinitions`;
const params = {
CustomerIssuerId: 1,
SystemControlIssuerId: 1,
};
try {
const response = await axios.get(endpoint, {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
params: params,
});
console.log(JSON.stringify(response.data, null, 2));
} catch (error) {
console.error('Error calling GetIssuerActiveCertificateDefinitions:', error);
}
}
async function main(): Promise<void> {
const accessToken = await getAccessToken();
if (accessToken) {
await getIssuerActiveCertificateDefinitions(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';
// Prepare the token request data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// 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() {
try {
// Make a POST request to get token
const tokenResponse = await makeRequest(tokenEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}, tokenData);
// Handle the response
if (tokenResponse.statusCode === 200) {
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request to GetIssuerActiveCertificateDefinitions
const apiUrl = '{{baseurl}}/api/v1/Issuer/GetIssuerActiveCertificateDefinitions?CustomerIssuerId=1&SystemControlIssuerId=1';
const apiResponse = await makeRequest(apiUrl, {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
// Print the JSON response from the API
const responseData = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseData, null, 2));
} else {
console.error('Error obtaining access token:', tokenResponse.statusCode, tokenResponse.body);
}
} catch (error) {
console.error('Error:', error.message);
}
}
main();
200 Response:
[
{
"certificateDefinitionId": 2280,
"prefix": "C",
"isBook": false,
"securityType": "Common"
},
{
"certificateDefinitionId": 2281,
"prefix": "P",
"isBook": false,
"securityType": "Preferred"
},
{
"certificateDefinitionId": 2282,
"prefix": "BAL",
"isBook": true,
"securityType": "Common"
},
{
"certificateDefinitionId": 2283,
"prefix": "BAL",
"isBook": true,
"securityType": "Warrant"
},
{
"certificateDefinitionId": 2329,
"prefix": "BE",
"isBook": true,
"securityType": "Common"
}
]
GET Issuer/GetTransferAgentIssuers#
Description:
Retrieves a list of Issuers that use Transfer Agents to maintain their Securities and Shareholder Registries.
Query Parameters:
Example Request:✓
curl --silent --location '{{baseurl}}/api/v1/Issuer/GetTransferAgentIssuers' \
--header 'Authorization: Bearer <YOUR TOKEN>'
#!/bin/bash
# Set up environment variables (these should be set in your environment)
# export SOLO_CLIENT_ID="your_client_id"
# export SOLO_CLIENT_SECRET="your_client_secret"
# 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"
# Make a POST request to get the access token
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 the HTTP status code and response body
HTTP_STATUS=$(echo "$TOKEN_RESPONSE" | tail -n 1)
RESPONSE_BODY=$(echo "$TOKEN_RESPONSE" | sed '$d')
# Handle the 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/Issuer/GetTransferAgentIssuers"
# Make the API request to GetTransferAgentIssuers
API_RESPONSE=$(curl -s -X GET "$API_ENDPOINT" \
-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/Issuer/GetTransferAgentIssuers"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
api_response = requests.get(api_url, headers=headers)
# Print the Response
print(api_response.json())
else:
print(f"Error getting 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.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: Failed to retrieve access token. Status code: {tokenResponse.StatusCode}");
string errorBody = await tokenResponse.Content.ReadAsStringAsync();
Console.WriteLine($"Response: {errorBody}");
return;
}
// Make the API request
string apiEndpoint = "{{baseurl}}/api/v1/Issuer/GetTransferAgentIssuers";
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.IsSuccessStatusCode)
{
JsonDocument jsonResponse = JsonDocument.Parse(apiResponseBody);
string formattedJson = JsonSerializer.Serialize(jsonResponse, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(formattedJson);
}
else
{
Console.WriteLine($"Error: API request failed. Status code: {apiResponse.StatusCode}");
Console.WriteLine($"Response: {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';
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// 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() {
try {
// Make a POST request to get token
const tokenResponse = await makeRequest(tokenEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}, tokenData);
// Handle the Response
if (tokenResponse.statusCode === 200) {
const tokenResult = JSON.parse(tokenResponse.body);
const accessToken = tokenResult.access_token;
// Make the API Request to GetTransferAgentIssuers
const apiEndpoint = '{{baseurl}}/api/v1/Issuer/GetTransferAgentIssuers';
const apiResponse = await makeRequest(apiEndpoint, {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
// Print the Response
if (apiResponse.statusCode === 200) {
const apiResult = JSON.parse(apiResponse.body);
console.log(JSON.stringify(apiResult, null, 2));
} else {
console.error(`API Error: ${apiResponse.statusCode}`);
console.error(apiResponse.body);
}
} else {
console.error(`Token Error: ${tokenResponse.statusCode}`);
console.error(tokenResponse.body);
}
} catch (error) {
console.error('Error:', error.message);
}
}
main();
import axios from 'axios';
async function main() {
// Set up environment variables
const clientId = process.env.SOLO_CLIENT_ID;
const clientSecret = process.env.SOLO_CLIENT_SECRET;
if (!clientId || !clientSecret) {
console.error('Error: SOLO_CLIENT_ID and SOLO_CLIENT_SECRET environment variables must be set');
process.exit(1);
}
// Define the OAuth2 Token Endpoint
const tokenEndpoint = '{{baseurl}}/connect/token';
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret,
});
try {
// Make a POST Request to get token
const tokenResponse = await axios.post(tokenEndpoint, tokenData.toString(), {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
// Handle the Response
if (tokenResponse.status === 200) {
const accessToken = tokenResponse.data.access_token;
// Make the API Request
const apiEndpoint = '{{baseurl}}/api/v1/Issuer/GetTransferAgentIssuers';
const apiResponse = await axios.get(apiEndpoint, {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
});
// Print the Response
console.log(JSON.stringify(apiResponse.data, null, 2));
} else {
console.error(`Error: Failed to retrieve token. Status code: ${tokenResponse.status}`);
}
} catch (error) {
if (axios.isAxiosError(error)) {
console.error(`Error: ${error.message}`);
if (error.response) {
console.error(`Status: ${error.response.status}`);
console.error(`Response: ${JSON.stringify(error.response.data, null, 2)}`);
}
} else {
console.error(`Error: ${error}`);
}
}
}
main();
const https = require('https');
const http = require('http');
const url = require('url');
// Set up environment variables
const SOLO_CLIENT_ID = process.env.SOLO_CLIENT_ID;
const SOLO_CLIENT_SECRET = process.env.SOLO_CLIENT_SECRET;
// Define the OAuth2 Token Endpoint
const tokenEndpoint = '{{baseurl}}/connect/token';
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: SOLO_CLIENT_ID,
client_secret: SOLO_CLIENT_SECRET
}).toString();
// Function to make HTTP requests
function makeRequest(requestUrl, options, postData = null) {
return new Promise((resolve, reject) => {
const parsedUrl = url.parse(requestUrl);
const protocol = parsedUrl.protocol === 'https:' ? https : http;
const reqOptions = {
hostname: parsedUrl.hostname,
port: parsedUrl.port,
path: parsedUrl.path,
...options
};
const req = protocol.request(reqOptions, (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();
});
}
// Main function to execute the API calls
async function main() {
try {
// Make a POST request to get token
const tokenResponse = await makeRequest(tokenEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}, tokenData);
// Handle the Response
if (tokenResponse.statusCode === 200) {
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request to GetTransferAgentIssuers
const apiEndpoint = '{{baseurl}}/api/v1/Issuer/GetTransferAgentIssuers';
const apiResponse = await makeRequest(apiEndpoint, {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
// Print the Response
if (apiResponse.statusCode === 200) {
const responseJson = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseJson, null, 2));
} else {
console.error(`API request failed with status code: ${apiResponse.statusCode}`);
console.error(apiResponse.body);
}
} else {
console.error(`Token request failed with status code: ${tokenResponse.statusCode}`);
console.error(tokenResponse.body);
}
} catch (error) {
console.error('Error:', error.message);
}
}
main();
200 Response:
[
{
"name": "Z-TestCompany",
"customerIssuerId": 127087,
"controlIssuerId": 6439,
"status": "Active",
"primaryAddress": {
"address1": "1222 Harrison St",
"address2": "",
"city": "San Francisco",
"state": "CA",
"postalCode": "402108213",
"country2Code": "US",
"email": "aaaatestdatacompany@gmai.in",
"phone": "3242342424",
"secondaryPhone": "",
"country": "United States"
}
},
{
"name": "Z-TestCompany",
"customerIssuerId": 127070,
"controlIssuerId": 6422,
"status": "Pending",
"primaryAddress": {
"address1": "1127 Industrial Rd",
"address2": "",
"city": "San Carlos",
"state": "CA",
"postalCode": "94070",
"country2Code": "US",
"email": "gunja@gmail.com",
"phone": "8978978789",
"secondaryPhone": "",
"country": "United States"
}
}
]
GET Issuer/GetIssuerBalance#
Description:
Retrieves balance for a given Issuer.
Query Parameters:
Blank = All Securities.
C = Common Securities.
P = Preferred Securities.
Blank = No series specified.
A = Series A.
B = Series B.
C = Series C.
Note
Refer to the Expanded Attributes and Options page for more info on securityType options.
All = Restricted and Non-Restricted.
Restricted = Restricted Shares.
NonRestricted = Non-Restricted Shares.
Example Request:✓
curl --silent --location '{{baseurl}}/api/v1/Issuer/GetIssuerBalance?CustomerIssuerId=1&SystemControlIssuerId=1&FilterSecurityType.SecurityTypeCode=example&FilterSecurityType.SecuritySeriesCode=example&RestrictionStatus=All&CutoffDate=2024-01-01T00:00:00Z' \
--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"
# Make POST request to get token
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/Issuer/GetIssuerBalance"
# Make the API request to GetIssuerBalance
API_RESPONSE=$(curl -s -X GET "$API_ENDPOINT?CustomerIssuerId=1&SystemControlIssuerId=1&FilterSecurityType.SecurityTypeCode=example&FilterSecurityType.SecuritySeriesCode=example&RestrictionStatus=All&CutoffDate=2024-01-01T00:00:00Z" \
-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/Issuer/GetIssuerBalance"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
params = {
"CustomerIssuerId": 1,
"SystemControlIssuerId": 1,
"FilterSecurityType.SecurityTypeCode": "example",
"FilterSecurityType.SecuritySeriesCode": "example",
"RestrictionStatus": "All",
"CutoffDate": "2024-01-01T00:00:00Z"
}
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.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 baseUrl = "{{baseurl}}";
string apiEndpoint = $"{baseUrl}/api/v1/Issuer/GetIssuerBalance?CustomerIssuerId=1&SystemControlIssuerId=1&FilterSecurityType.SecurityTypeCode=example&FilterSecurityType.SecuritySeriesCode=example&RestrictionStatus=All&CutoffDate=2024-01-01T00:00:00Z";
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';
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// 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() {
try {
// Make a POST Request to get token
const tokenResponse = await makeRequest(tokenEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}, tokenData);
// Handle the Response
if (tokenResponse.statusCode !== 200) {
console.error('Error obtaining access token:', tokenResponse.body);
return;
}
const tokenResult = JSON.parse(tokenResponse.body);
const accessToken = tokenResult.access_token;
// Make the API Request to GetIssuerBalance
const apiBaseUrl = '{{baseurl}}';
const queryParams = new URLSearchParams({
CustomerIssuerId: '1',
SystemControlIssuerId: '1',
'FilterSecurityType.SecurityTypeCode': 'example',
'FilterSecurityType.SecuritySeriesCode': 'example',
RestrictionStatus: 'All',
CutoffDate: '2024-01-01T00:00:00Z'
}).toString();
const apiUrl = `${apiBaseUrl}/api/v1/Issuer/GetIssuerBalance?${queryParams}`;
const apiResponse = await makeRequest(apiUrl, {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
// Print the Response
if (apiResponse.statusCode === 200) {
const jsonResponse = JSON.parse(apiResponse.body);
console.log(JSON.stringify(jsonResponse, null, 2));
} else {
console.error('API Error:', apiResponse.statusCode, apiResponse.body);
}
} catch (error) {
console.error('Error:', 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 baseUrl = '{{baseurl}}';
const tokenEndpoint = `${baseUrl}/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(tokenEndpoint, 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 getIssuerBalance(accessToken: string): Promise<void> {
const apiEndpoint = `${baseUrl}/api/v1/Issuer/GetIssuerBalance`;
const params = {
CustomerIssuerId: 1,
SystemControlIssuerId: 1,
'FilterSecurityType.SecurityTypeCode': 'example',
'FilterSecurityType.SecuritySeriesCode': 'example',
RestrictionStatus: 'All',
CutoffDate: '2024-01-01T00:00:00Z',
};
try {
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 GetIssuerBalance:', error);
}
}
async function main(): Promise<void> {
const accessToken = await getAccessToken();
if (accessToken) {
await getIssuerBalance(accessToken);
} else {
console.error('Failed to obtain access token');
}
}
main();
const https = require('https');
const http = require('http');
const { URL } = require('url');
// Set up 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';
// Prepare the Token Request Data
const tokenData = new URLSearchParams({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}).toString();
// 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() {
try {
// Make a POST Request to get token
const tokenResponse = await makeRequest(tokenEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}, tokenData);
// Handle the Response
if (tokenResponse.statusCode === 200) {
const tokenJson = JSON.parse(tokenResponse.body);
const accessToken = tokenJson.access_token;
// Make the API Request
const apiUrl = '{{baseurl}}/api/v1/Issuer/GetIssuerBalance?CustomerIssuerId=1&SystemControlIssuerId=1&FilterSecurityType.SecurityTypeCode=example&FilterSecurityType.SecuritySeriesCode=example&RestrictionStatus=All&CutoffDate=2024-01-01T00:00:00Z';
const apiResponse = await makeRequest(apiUrl, {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
// Print the Response
const responseJson = JSON.parse(apiResponse.body);
console.log(JSON.stringify(responseJson, null, 2));
} else {
console.error('Error getting token:', tokenResponse.statusCode, tokenResponse.body);
}
} catch (error) {
console.error('Error:', error.message);
}
}
main();
200 Response:
[
{
"issuerId": 129,
"customerIssuerId": 129,
"className": "C",
"totalShareholder": 9,
"securityID": 1,
"securityDescription": "Common",
"authorizedShares": 35352323,
"authorizedSharesFormat": "35,352,323",
"totalIssuedShares": 439955,
"totalIssuedSharesFormat": "439,955",
"totalOutstandingShares": 439955,
"totalOutstandingSharesFormat": "439,955",
"totalReserveShares": 0,
"totalReserveSharesFormat": "0",
"totalRestrictedShares": 379745,
"totalRestrictedSharesFormat": "379,745",
"totalNonRestrictedShares": 60210,
"totalNonRestrictedSharesFormat": "60,210",
"isUnlimited": false,
"dollarFormat": false
},
{
"issuerId": 129,
"customerIssuerId": 129,
"className": "W",
"totalShareholder": 2,
"securityID": 2,
"securityDescription": "Warrant",
"authorizedShares": 36363262,
"authorizedSharesFormat": "36,363,262",
"totalIssuedShares": 2500,
"totalIssuedSharesFormat": "2,500",
"totalOutstandingShares": 2500,
"totalOutstandingSharesFormat": "2,500",
"totalReserveShares": 0,
"totalReserveSharesFormat": "0",
"totalRestrictedShares": 0,
"totalRestrictedSharesFormat": "0",
"totalNonRestrictedShares": 2500,
"totalNonRestrictedSharesFormat": "2,500",
"isUnlimited": false,
"dollarFormat": false
},
{
"issuerId": 129,
"customerIssuerId": 129,
"className": "P",
"totalShareholder": 2,
"securityID": 6,
"securityDescription": "Preferred",
"authorizedShares": 10000000,
"authorizedSharesFormat": "10,000,000",
"totalIssuedShares": 162,
"totalIssuedSharesFormat": "162",
"totalOutstandingShares": 162,
"totalOutstandingSharesFormat": "162",
"totalReserveShares": 0,
"totalReserveSharesFormat": "0",
"totalRestrictedShares": 0,
"totalRestrictedSharesFormat": "0",
"totalNonRestrictedShares": 162,
"totalNonRestrictedSharesFormat": "162",
"isUnlimited": false,
"dollarFormat": false
}
]