Get Started
Install Knox API Package
The recommended environment for installation and use is as follows:
Node.js 16 or higher
- npm
- yarn
- pnpm
npm install @redredgroup/samsungknox-api
shell yarn install @redredgroup/samsungknox-api
pnpm install @redredgroup/samsungknox-api
Class or function calls
The cases for both codes are described for every endpoint, and you can use them in any way that makes sense for your own codebase.
Using the API with instances (Class)
This feature is available in @redredgroup/samsungknox-api version 1.4.0 or later.
If you're using the Class syntax or in a situation where region and X-KNOX-APITOKEN don't change due to region, it's recommended that you use a KnoxInstance to access the API. With Class, you can pass region and knoxAccessToken as variables once and not have to specify them for each API.
Example
Below is an example of calling Get Profile (Many) as an instance to Knox Configure.
import { KnoxInstance } from '@redredgroup/samsungknox-api';
const instance = new KnoxInstance({
knoxAccessToken: 'YOUR-X-KNOX-APITOKEN',
region: 'YOUR-KNOX-REGION',
});
const getProfiles = await instance.kcProfile.getProfiles({
args: {}, // <- KnoxConfigure Get Profiles Param
});
console.log(getProfiles);
Using the API with Functions
If you are using the Function syntax or have a lot of region changes due to region, you may want to consider using functions to access the API. Functions allow you to pass region and knoxAccessToken to each function, which is advantageous for getting data from different regions for different APIs or for getting a lot of simple data.
Example
Below is an example of calling Get Profile (Many) as a Function in Knox Configure.
import { kcGetProfiles } from '@redredgroup/samsungknox-api';
const getProfiles = await kcGetProfiles({
args: {} // <- KnoxConfigure Get Profiles Param
region: 'YOUR-KNOX-REGION'
knoxAccessToken: 'YOUR-X-KNOX-APITOKEN',
})
console.log(getProfiles)