We publish official clients for PHP, Python, JavaScript, .NET and Go. The
JavaScript client works with TypeScript too. Each one is generated from the same OpenAPI document as
the reference, so it has every endpoint and field. The
client signs in for you and renews the token before it expires. It sends
an Idempotency-Key with every write and waits out a Retry-After before
trying again.
| Language | Install | Source |
|---|---|---|
| PHP 8.1 or later | composer require checknetworks/checknetworks-php |
checknetworks-php |
| Python 3.11 or later | pip install checknetworks |
checknetworks-python |
| JavaScript and TypeScript, Node 18 or later | npm install @checknetworks/sdk |
checknetworks-js |
| .NET 8 or later | dotnet add package CheckNetworks |
checknetworks-dotnet |
| Go 1.26 or later | go get github.com/CheckNetworksAU/checknetworks-go/v2 |
checknetworks-go |
Each client has the same version number as the reference. Until launch that is a pre-release. Composer and NuGet install a pre-release only when you ask for one:
composer require checknetworks/checknetworks-php:^2.0@RC
dotnet add package CheckNetworks --prerelease
A first call
Give the client your API key’s Client ID and Client Secret and the scopes
you need. It picks the base URL from the secret. A secret starting
cn_test_ goes to the sandbox, and one starting
cn_live_ goes to production. Each example below calls GET /ping.
PHP
use CheckNetworks\Api\AuthenticationApi;
use CheckNetworks\CheckNetworks;
$cn = CheckNetworks::create(
clientId: getenv('CN_CLIENT_ID'),
clientSecret: getenv('CN_CLIENT_SECRET'),
scope: ['account:read'],
);
$ping = $cn->api(AuthenticationApi::class)->ping()->getResult();
echo $ping->getAccountId(), ' ', $ping->getEnvironment(), "\n";
Python
import os
import checknetworks
from checknetworks.api.authentication import ping
cn = checknetworks.create_client(
os.environ["CN_CLIENT_ID"],
os.environ["CN_CLIENT_SECRET"],
scope=["account:read"],
)
me = ping.sync(client=cn)
print(me.result.account_id, me.result.environment)
JavaScript and TypeScript
import { createCheckNetworksClient } from "@checknetworks/sdk";
const cn = createCheckNetworksClient({
clientId: process.env.CN_CLIENT_ID!,
clientSecret: process.env.CN_CLIENT_SECRET!,
scope: ["account:read"],
});
const ping = await cn.GET("/ping");
console.log(ping.data?.result.accountId, ping.data?.result.environment);
.NET
using CheckNetworks;
using CheckNetworks.Api;
using var cn = new CheckNetworksClient(new CheckNetworksOptions
{
ClientId = Environment.GetEnvironmentVariable("CN_CLIENT_ID")!,
ClientSecret = Environment.GetEnvironmentVariable("CN_CLIENT_SECRET")!,
Scope = ["account:read"],
});
var ping = await cn.Api<AuthenticationApi>().PingAsync();
Console.WriteLine($"{ping.Result.AccountId} {ping.Result.VarEnvironment}");
Go
cn, err := checknetworks.NewClient(checknetworks.Options{
ClientID: os.Getenv("CN_CLIENT_ID"),
ClientSecret: os.Getenv("CN_CLIENT_SECRET"),
Scope: []string{"account:read"},
})
if err != nil {
log.Fatal(err)
}
ping, _, err := cn.AuthenticationAPI.Ping(context.Background()).Execute()
if err != nil {
log.Fatal(err)
}
fmt.Println(ping.Result.AccountId, ping.Result.Environment)
Keeping the secret safe
Keep the Client Secret on a server. Never ship it to a browser.
The README in each library’s repository lists its options and shows how it reports errors.
Another language
The OpenAPI document behind the reference is OpenAPI 3.1. Any generator that reads 3.1 can build a client from it.