Skip to main content

TypeScript SDK

Overview

Learn how to install and configure the TypeScript SDK in this guide.

Requirements

You need the following to use the TypeScript SDK:

  • Node. To learn how to download it and set it up, go here.

  • TypeScript. You can use npm to install TypeScript globally. This means that you can use the tsc command anywhere in your terminal. To do so, run this command:

npm install -g typescript
  • Your tenant name in ISC. To learn how to find it, refer to Getting Started. The SDK will use this tenant name to connect to your ISC instance.

  • A PAT with a client secret and ID. To learn how to create one in ISC, refer to Personal Access Tokens. The SDK will use this PAT to authenticate with the SailPoint APIs.

Setup

CLI Assisted (Recommended)

The SailPoint CLI offers a few commands that will allow you to quickly get started with the Typescript SDK. To learn how to install and use the SailPoint CLI, refer to SailPoint CLI.

Once the CLI is installed and configured, run this command to create a new Typescript project with the Typescript SDK:

sail sdk init typescript typescript-example

Running the command creates the structure for your project:

|-- typescript-example
| |-- package.json
| |-- src
| | |-- index.ts
| |-- tsconfig.json

Navigate into your project folder and run this command to install the required dependencies:

npm install

The SDK is now installed. To learn how to configure the SDK, refer to the Configure section.

Manual Installation

To begin your typescript project, you will need to create a directory for your project. Run this command to create your project directory:

mkdir typescript-example

Then run this command to change into your project directory:

cd typescript-example

To initialize your project directory and create the "package.json" file, run this command in your project directory.

npm init

You will update this file with the dependencies necessary to use the SDK.

Create a source folder named "src". The SDK will include the "src/*/" folder path when it compiles, so your SDK file must be there. Run this command to create the "src" folder:

mkdir src

Go to the src folder and create a file named "index.ts". You will need to compile the "index.ts" file to run the SDK. You can leave this "index.ts" file empty for now.

Go to the project directory and create a file named "tsconfig.json". This file will contain your compiler configuration. Copy this information into your "tsconfig.json" file:

{
"compilerOptions": {
"target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"module": "commonjs", /* Specify what module code is generated. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"esModuleInterop": true, /* Omit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"strict": true, /* Enable all strict type-checking options. */
"skipLibCheck": true,
"outDir": "./build",
"rootDir": "src",
"sourceMap": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}

Run this command to add the SailPoint SDK to your project's dependencies:

npm install sailpoint-api-client

Or run this command to do the same:

yarn add sailpoint-api-client

The SDK is now installed. To learn how to configure the SDK, refer to the Configure section.

Configure

You must provide configuration to the SDK so that it can authenticate to your SailPoint tenant and make API calls. To do so, you can use a configuration file, "config.json", or environment variables.

Configuration File

The SDK requires a configuration file to be named "config.json". Within the file, provide these key/value pairs: ClientID, ClientSecret, BaseUrl.

CLI Assisted (Recommended)
The SailPoint CLI offers a command to generate the config.json file with your currently configured CLI credentials.
sail sdk init config

If you have multiple environments configured with the CLI, you can pass an additional parameter to state the environment you wish to create a "config.json" for.

To pass an additional parameter that states the environment you want to configure, run this command:

sail sdk init config --env devrel

Example "config.json"

{
"ClientID": "g0567b766b413b22c05c66e75d532f1b",
"ClientSecret": "cabd0e950a7230b63c1ff45be33fb22065b382b6251a73c61177a8bb5482fcc7",
"BaseUrl": "https://[tenant].api.identitynow.com"
}
Manual Configuration

Create a file named "config.json", and provide these key/value pairs: ClientID, ClientSecret, BaseUrl.

Example "config.json"

{
"ClientID": "g0567b766b413b22c05c66e75d532f1b",
"ClientSecret": "cabd0e950a7230b63c1ff45be33fb22065b382b6251a73c61177a8bb5482fcc7",
"BaseUrl": "https://[tenant].api.identitynow.com"
}
danger

Please ensure this file is ignored in your version control system (ex. .gitignore for git)

Environment variable configuration

You can also store your configuration in environment variables.

To get your environment variables to persist across terminal sessions, add these exports to your shell profile, something like ~/.bash_profile.

export SAIL_BASE_URL=https://[tenant].api.identitynow.com
export SAIL_CLIENT_ID=[clientID]
export SAIL_CLIENT_SECRET=[clientSecret]

Discuss

You can use this SDK to build new tools that extend your ISC platform and improve experiences across your organization. Use this guide to get started, and if you have questions, don't hesitate to reach out on the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss!

Getting Started

To get started using the SDK, refer to the Getting Started Guide.