Skip to main content

Getting Started

1. Install

Node Swit SDK can be easily installed via npm.

Run the following command in the root directory of your project.

npm install @swit-api/api-client @swit-api/oauth

2. Get the ApiClient

Create an instance by inserting the access token obtained from oauth api with the ApiClient class.

You can use v1 open api through v1 properties on created client objects.

import { ApiClient, ApiClientConfig } from '@swit-api/api-client';

const token = process.env.SWIT_OPEN_API_TOKEN; // YOUR ACCESS TOKEN
const config: ApiClientConfig= {
token: SWIT_OPEN_API_TOKEN,
};

const client = new ApiClient(config);
const clientV1 = client.v1;

3. Call Api

ClientV1 provides services for each domain assigned as a business-based property It is available.

You can import user information as shown in the example below.


const clientV1 = client.v1;

const res = await client.user.userInfo();

Please refer to the link below for additional ClientV1 information.

4. Service clientV1 mapping by properties

Property NameService Name
approvalApprovalService
channelChannelService
chatChatService
chatMessageChatMessageService
customFieldCustomFieldService
ideaIdeaService
ideaCommentIdeaCommentService
membershipMembershipService
messageMessageService
messageCommentMessageCommentService
projectProjectService
projectBucketProjectBucketService
taskTaskService
taskChecklistTaskChecklistService
taskCommentTaskCommentService
teamTeamService
userUserService
workspaceWorkspaceService

5. Direct access to internal Axios instance

Use internally when a separate customization of settings is required You can also access and use an Axios instance.

const client = new ApiClient(config);
client.clientV1AxiosRef.interceptors.response.use(
(response) => {
// response handle
return response;
},
(error) => {
// error handle
return Promise.reject(error);
}
);