Certificate#
Allows you to retrieve a list of certificates.
Endpoints:#
GET Certificate/GetHoldingCertificates#
Description:
Retrieves holding certificates for a given customer.
Query Parameters:
customerIssuerId
integer
Required
Nullable
The unique identifier of the customer issuer.
customerShareholderId
string
Optional
Non-nullable
The unique shareholder ID associated with the customer.
filterStatus
string
Required
Non-nullable
Status used to filter certificates.
Example Request:✓
curl --silent --location '{{baseurl}}/api/v1/Certificate/GetHoldingCertificates?CustomerIssuerId=1&SystemControlIssuerId=1&CustomerShareholderId=example&SystemShareholderId=1&FilterStatus=All' \
--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 (last line) 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_BASE_URL="{{baseurl}}"
ENDPOINT="/api/v1/Certificate/GetHoldingCertificates"
# Make the API request to GetHoldingCertificates
API_RESPONSE=$(curl -s -X GET "${API_BASE_URL}${ENDPOINT}?CustomerIssuerId=1&SystemControlIssuerId=1&CustomerShareholderId=example&SystemShareholderId=1&FilterStatus=All" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json")
# Print the JSON response from the API
echo "API Response:"
echo "$API_RESPONSE" | python3 -m json.tool 2>/dev/null || 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_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/Certificate/GetHoldingCertificates"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
params = {
"CustomerIssuerId": 1,
"SystemControlIssuerId": 1,
"CustomerShareholderId": "example",
"SystemShareholderId": 1,
"FilterStatus": "All"
}
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);
// 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/Certificate/GetHoldingCertificates";
// Build query parameters
var queryParams = new Dictionary<string, string>
{
{ "CustomerIssuerId", "1" },
{ "SystemControlIssuerId", "1" },
{ "CustomerShareholderId", "example" },
{ "SystemShareholderId", "1" },
{ "FilterStatus", "All" }
};
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)
{
try
{
JsonDocument jsonDoc = JsonDocument.Parse(apiResponseContent);
string formattedJson = JsonSerializer.Serialize(jsonDoc, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(formattedJson);
}
catch (JsonException)
{
Console.WriteLine(apiResponseContent);
}
}
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;
const TOKEN_ENDPOINT = '{{baseurl}}/connect/token';
const API_BASE_URL = '{{baseurl}}';
async function getAccessToken() {
return new Promise((resolve, reject) => {
const postData = querystring.stringify({
grant_type: 'client_credentials',
client_id: SOLO_CLIENT_ID,
client_secret: SOLO_CLIENT_SECRET
});
const url = new URL(TOKEN_ENDPOINT);
const options = {
hostname: url.hostname,
path: url.pathname,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(postData)
}
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
if (res.statusCode === 200) {
const response = JSON.parse(data);
resolve(response.access_token);
} else {
reject(new Error(`Failed to get token: ${res.statusCode} - ${data}`));
}
});
});
req.on('error', (error) => {
reject(error);
});
req.write(postData);
req.end();
});
}
async function getHoldingCertificates(accessToken) {
return new Promise((resolve, reject) => {
const queryParams = querystring.stringify({
CustomerIssuerId: 1,
SystemControlIssuerId: 1,
CustomerShareholderId: 'example',
SystemShareholderId: 1,
FilterStatus: 'All'
});
const url = new URL(`${API_BASE_URL}/api/v1/Certificate/GetHoldingCertificates?${queryParams}`);
const options = {
hostname: url.hostname,
path: url.pathname + url.search,
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
if (res.statusCode === 200) {
resolve(JSON.parse(data));
} else {
reject(new Error(`API request failed: ${res.statusCode} - ${data}`));
}
});
});
req.on('error', (error) => {
reject(error);
});
req.end();
});
}
async function main() {
try {
console.log('Retrieving access token...');
const accessToken = await getAccessToken();
console.log('Access token retrieved successfully.');
console.log('Calling GetHoldingCertificates endpoint...');
const response = await getHoldingCertificates(accessToken);
console.log('Response:');
console.log(JSON.stringify(response, 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/Certificate/GetHoldingCertificates';
const apiResponse = await axios.get(apiEndpoint, {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
params: {
CustomerIssuerId: 1,
SystemControlIssuerId: 1,
CustomerShareholderId: 'example',
SystemShareholderId: 1,
FilterStatus: 'All',
},
});
// 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.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, data: data });
});
});
req.on('error', (error) => {
reject(error);
});
if (postData) {
req.write(postData);
}
req.end();
});
}
async function main() {
try {
// Prepare token request data
const tokenData = querystring.stringify({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
});
// Make POST request to get token
const tokenUrlObj = new URL(tokenUrl);
const tokenOptions = {
hostname: tokenUrlObj.hostname,
path: tokenUrlObj.pathname,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(tokenData)
}
};
const tokenResponse = await makeRequest(tokenUrl, tokenOptions, tokenData);
if (tokenResponse.statusCode !== 200) {
console.error('Error getting token:', tokenResponse.data);
return;
}
const tokenJson = JSON.parse(tokenResponse.data);
const accessToken = tokenJson.access_token;
// Prepare API request parameters
const queryParams = querystring.stringify({
CustomerIssuerId: 1,
SystemControlIssuerId: 1,
CustomerShareholderId: 'example',
SystemShareholderId: 1,
FilterStatus: 'All'
});
const apiUrl = `{{baseurl}}/api/v1/Certificate/GetHoldingCertificates?${queryParams}`;
const apiUrlObj = new URL(apiUrl);
const apiOptions = {
hostname: apiUrlObj.hostname,
path: apiUrlObj.pathname + apiUrlObj.search,
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
};
// Make API request
const apiResponse = await makeRequest(apiUrl, apiOptions);
// Print the response
if (apiResponse.statusCode === 200) {
const responseJson = JSON.parse(apiResponse.data);
console.log(JSON.stringify(responseJson, null, 2));
} else {
console.error('API Error:', apiResponse.statusCode, apiResponse.data);
}
} catch (error) {
console.error('Error:', error.message);
}
}
main();
200 Response:
{
"controlCertificateId": 66634,
"customerCertificateId": 9120982,
"prefixAndCertificateNumber": "B-1112",
"issued": "10/29/2018",
"canceled": "",
"security": "Common",
"restriction": "No Restriction",
"stop": "",
"shares": 17,
"postReverseSplit": true
}