About our CLI

With our CLI you can create your own catalog of components like components, functions and data-transformations. You can also consume the global components provided by LinkApi.

Our CLI (Command Line Interface) offers you a series of tools dedicated to developing and managing your projects on LinkApi.

Setup

Before installing LinkApi CLI, you’ll need to install Node.js(8.12.0+). Having it installed, you can use NPM, which is Node package manager, to install our CLI executing the following command:

npm i -g @linkapi.solutions/linkapi-cli

Now you have a linkapi global command, which can be executed on any terminal window. After installing the CLI, you’ll need to login on your Google account, using:

linkapi login

This command allows your local machine to connect to your LinkApi account, as well as access to your projects. In order to test if the automation worked, you can execute linkapi project list to see your whole project list. It needs to have the same projects that you can see on you LinkApi’s portal.

How to get the latest version?

To check if your CLI is updated, you have to execute the installation command once again:

npm i -g @linkapi.solutions/linkapi-cli

Projects

linkapi.json File

The configuration file linkapi.json, located at your project’s root, has the purpose of identifying which project is being used, and if it’s a valid one.

Notice: if you delete or change this file, your project might lose all of its compatibility with the CLI and LinkApi’s portal.

readme.md File

This is a glossary, with all of the technical terms we use on our platform.
Automations, functions and data transformation folders

These contain the needed files in any kind of execution on your project. For each folder, there is also a .js example file. It’s worth mentioning our projects only support Javascript.

Notice: When creating folders within the aforementioned folder, renaming or deleting them might cause compatibility loss from the project with our platform.

Creating a project

To create a project via CLI, you should use the following command:

linkapi project create or linkapi p create

After executing the command, answer the questions on the form and at the end the project will be automatically cloned.

Cloning a project

The first thing you need is a created project (via CLI or Portal). Now, to clone a project via CLI, you should use the following command:

linkapi project list or linkapi p l

After executing the command, a list of available projects will be displayed, just select the desired project and press enter. After selecting the project, select the Clone option.
It is only possible to clone automation-type projects.

Managing a project dependencies

The first thing you need is a created project (via CLI or Portal). Now, to manage a project dependencies via CLI, you should use the following command:

linkapi project list or linkapi p l

After executing the command, a list of available projects will be displayed, just select the desired project and press enter. After selecting the project, select the Manage Dependencies option.
A list will be displayed with the available components, just select the desired ones by pressing SPACE and press ENTER after selecting all the desired components.

399

Components list(CLI)

Then a list of functions will be displayed and the selection procedure is the same as that of components.

Deleting a project

The first thing you need is a created project (via CLI or Portal). Now, to delete a project via CLI, you should use the following command:

linkapi project list or linkapi p l

After executing the command, a list of available projects will be displayed, just select the desired project and press enter. After selecting the project, select the Delete option and confirm.

Generate files from templates on a project.

To generate a file from automation, function or data-transformation template, you should execute the following command:

linkapi generate <type> <name> or linkapi g <type> <name:

Mandatory:

Valid values: automation, function or data-transformation
file name

After executing this command, the file will be created from a template according to the declared type. Example:

linkapi project generate automation test

Executing files from a project

To execute a file in a project, you can use this command:

linkapi run --path <path> or  linkapi r -p path

Mandatory:

--path or -p (file path to be executed)

Optional:
--tenant or -t (Tenant name or id)
--params (JSON file path or raw text)

Saving a project’s changes

To save the changes you made into a project, you can use the following command:

linkapi project commit [message]

After executing this command, all of the changes will be saved on the platform.
Notice: When committing a project, the message is optional.

Discard project changes

To discard all of the changes made on a project at once, you can execute this command:

linkapi project discard or linkapi p d

Publishing your project

To publish a project via CLI, use this command:

linkapi project publish or linkapi p p

After executing it, all of the changes will be moved to the master branch (in production).
Notice: when publishing a project, only development branch will be moved to the master one, thus, creating more branches won’t affect the project.

Sync Projects

To merge changes of a project using CLI, use the following command:

linkapi project sync or linkapi p s

After executing this command, your project will be synced and all of the changes will be merged in its directory

Creating a job

To create a job via CLI, you should use the following command:

linkapi job create or linkapi j c

After executing the command, answer the questions on the form and at the end the job will be created.

Starting a job

To start a job via CLI, you should use the following command:

linkapi job list or linkapi j l

After executing the command, a list of available jobs will be displayed, just select the desired job and press enter. After selecting the job, select the Run option.

Deleting a job

The first thing you need is a created job (via CLI or Portal). Now, to delete a job via CLI, you should use the following command:

linkapi job list or linkapi j l

After executing the command, a list of available jobs will be displayed, just select the desired job and press enter. After selecting the job, select the Delete option and confirm.

This is the list off all commands that you can run with the CLI.

Command "parameter"Description
loginLog in to your account.
logoutLog out of your account.
--helpSee the list of commands of CLI.
--versionSee the CLI version.