You should use the latest LTS version of NodeJS. We do not support versions of NodeJS for which LTS has ended.
Install the following software:
- Extract the dsm-js-sdk.zip file.
- Open Command Line or Terminal and change the current directory to the directory of the extracted contents.
- Enter the following command to install dependencies:
- Enter the following command to create a symbolic link from the repository to the package in the SDK directory:
yarn linkYou should see output that is similar to the following example:
yarn link v1.6.0 success Registered "@trendmicro/deepsecurity". info You can now run `yarn link "@trendmicro/deepsecurity"` in the projects where you want to use this package and it will be used instead. Done in 0.05s.
Download and install Visual Studio Code.
Follow the Visual Studio Code installation instructions for your Linux distribution.
Add the SDK to a workspace in Visual Studio Code
Follow the procedure below to create a NodeJS project that can run the code examples in the Automation Center guides.
- Create a folder for your NodeJS project.
- In the NodeJS project folder you created, open Command Line or Terminal.
- Enter the following command to create a symbolic link from your NodeJS project to the @trendmicro/deepsecurity package:
yarn link "@trendmicro/deepsecurity"You should see output that is similar to the following example:
yarn link v1.6.0 success Using linked package for "@trendmicro/deepsecurity". Done in 0.06s.For more information about the
yarn unlinkcommand, see the Yarn unlink documentation.
- Open Visual Studio Code.
- Click File > Add folder to workspace and select the NodeJS project folder.
- Click File > Save Workspace as and save your project.
You can save the project workspace in any location; it does not have to be in the NodeJS project folder.
- To get familiar with how to use the SDK with the Deep Security API, see the Send Your First Request Using the API guide.
If you are already familiar with using an API or have specific tasks that you want to use the SDK for, see Run the Code Examples to get started with the task-based examples in other Automation Center guides.
You can add the code examples from any of the other Automation Center guides to the project you created above.
If your project is linked to the @trendmicro/deepsecurity package and you want to use a newer release of the package, remove the links that you set up for the previous version. After you remove the links, you can install the newer package and set up links as you did for the previous package.
- Open Command Line or Terminal and change the current directory to your project directory.
- Enter the following command:
yarn unlink "@trendmicro/deepsecurity"You should see output that is similar to the following example:
yarn unlink v1.6.0 success Removed linked package "@trendmicro/deepsecurity". info You will need to run `yarn` to re-install the package that was linked. Done in 0.12s.
- Enter the following command:
yarn unlinkYou should see output that is similar to the following example:
yarn unlink v1.6.0 success Unregistered "@trendmicro/deepsecurity". info You can now run `yarn unlink "@trendmicro/deepsecurity"` in the projects where you no longer want to use this package.Done in 0.05s.
- To upgrade the package, use the steps in the previous sections to [download and install the SDK](#install) and link your project to the package.
For more information about the
yarn unlink command, see the Yarn unlink documentation.