Appearance
Connecting With API Keys
This guide will show you how to connect to the Nordic Space Link Stations using API Keys.
Prerequisites
- You need to have an API Key created. You can create one in the User section of the sidebar.
- You need your personal identifier, which can be found in the bottom of the API Keys section in the sidebar.
Connecting
Communication with Stations is using NATS, a high-performance messaging system. Connecting to NATS varies depending on the programming language you are using, but the general idea is the same.
URL:wss://nats.nordicspacelink.com:443
Connection Name:APIKey.<StationGuid>
INBOX Prefix:_INBOX.<PersonalIdentifier>.<StationGuid>
Auth Token: The API Key token, which can be generated in the User section of the sidebar.
When you create a new API Key, the token will be shown to you once. Make sure to copy it and store it safely, as it won't be shown again.
Examples
NATS CLI
bash
nats \
--server="wss://nats.nordicspacelink.com:443" \
--token="<API Key>" \
--inbox-prefix="_INBOX.<PersonalIdentifier>.<StationGuid>" \
--connection-name="APIKey.<StationGuid>" \
req "Station.<StationGuid>.Requests.ListStoredProtocolStacks" "".NET
Install NATS.Net using
dotnet add package NATS.net --version 2.6.3
cs
#! /bin/dotnet
#:package NATS.net@2.6.3
using NATS.Client.Core;
var authOpts = new NatsAuthOpts()
{
Token = "<API Key>"
};
var natsOpts = new NatsOpts()
{
Url = "wss://nats.nordicspacelink.com:443",
InboxPrefix = "_INBOX.<PersonalIdentifier>.<StationGuid>",
AuthOpts = authOpts,
Name = "APIKey.<StationGuid>"
};
await using var connection = new NatsConnection(natsOpts);
var response = await connection.RequestAsync<string, string>("Station.<StationGuid>.Requests.ListStoredProtocolStacks", "");
Console.WriteLine(response.Data);