Library which allows you to fully manage signageOS applets, devices, management & monitoring using JS.
npm install @signageos/sdk
Mandatory ENV variables (when using SDK api/rest singleton - deprecated. Use factories createApiV1 or createApiV2 instead):
in .env file:
# Organization API SECURITY TOKENS
SOS_AUTH_CLIENT_ID="...OAuthClientID..."
SOS_AUTH_SECRET="...OAuthSecret..."
# Account API SECURITY TOKENS
SOS_API_IDENTIFICATION="...apiSecurityTokenID..."
SOS_API_SECURITY_TOKEN="...apiSecurityToken..."
Optional ENV variable adjustment (with default values):
# REST API URL (default to the production server)
SOS_API_URL="https://api.signageos.io"
# How many times to retry request until it fails
SOS_REQUEST_MAX_ATTEMPTS="3"
Box in the side menu select Organize and sub menu OrganizationsAPI tokensAdd new token and generate new values.env file SOS_AUTH_CLIENT_ID is Token ID and SOS_AUTH_SECRET is
Token SecretBox in the top navigation menu click on account iconMy profileAdd new token and generate new values.env file SOS_API_IDENTIFICATION is Token ID and SOS_API_SECURITY_TOKEN is
Token SecretYou may read articles about setting up SDK & Rest API:
Please see the .env.dist file where all mandatory ENV variables, required for SDK usage, are listed too.
Just by setting ENV variables properly, you are ready to go and may use the api. If not ENV variables provided to
node.js app, it tries to get values from user's ~/.sosrc which is configured by
@signageos/cli dependency.
import { createApiV1 } from "@signageos/sdk";
const api = createApiV1(
{
url: 'https://api.signageos.io', // Optional
organizationAuth: {
clientId: '...OAuthClientID...',
secret: '...OAuthSecret...',
},
accountAuth: {
tokenId: '...apiSecurityTokenID...',
token: '...apiSecurityToken...',
},
},
);
// retrieves the list of all devices
const devices = await api.device.list();
// ...
import { createApiV2 } from "@signageos/sdk";
const api = createApiV2(
{
url: 'https://api.signageos.io', // Optional
organizationAuth: {
clientId: '...OAuthClientID...',
secret: '...OAuthSecret...',
},
accountAuth: {
tokenId: '...apiSecurityTokenID...',
token: '...apiSecurityToken...',
},
},
);
// retrieves the list of all devices
const devices = await api.device.list();
// ...
import { createApiV1 } from "@signageos/sdk";
// takes parameters from env vars
const api = createApiV1();
// retrieves the list of all devices
const devices = await api.device.list();
// ...
import { createApiV2 } from "@signageos/sdk";
// takes parameters from env vars
const api = createApiV2();
// retrieves the list of all devices
const devices = await api.device.list();
// ...
The complete SDK documentation may be generated by typedoc by running the command:
$ npm i && npm run docs
Once generated, the docs directory will contain the generated documentation.
The most useful documentation pages:
Setup env variables:
SOS_ORGANIZATION_UID=[ORGANIZATION_UID] // Add `organizationUid` on which will be the tests running
This SDK library contains several unit and integration tests, You may locate inside the sdk root directory and run
npm run test or npm run test-integration command.
If you properly configured all the mandatory environment variables either in .env file inside the sdk root or on your
machine, and you set
the integration tests will be launched too. Otherwise only unit test would be run and integrations tests would be
skipped.
Tip: you may use existing .env.dist file for creating the .env.
It may be arbitrary platform-dependent string but common values are listed in enumeration.
Generated using TypeDoc
It's only available in mongodb database for filtering purposes