Warning
You are viewing the technical documentation for Sharetribe. If you are looking for our no-code documentation, see our new help center.

Last updated

Getting started with Sharetribe CLI

This tutorial shows you how to get started with the Sharetribe CLI. You will learn how to log in with your API key, how to use the help command and other basic commands.

Table of Contents

Sharetribe CLI (Command-line interface) is a tool for changing your marketplace's advanced configurations such as transaction processes and email templates.

For this tutorial you should have basic knowledge of command-line and how to run basic commands.

Now, let's get started!

Install Sharetribe CLI

Sharetribe CLI is distributed via npmjs. To install packages from npmjs, you will need to download and install Node.js development environment:

When you have installed Node.js and Yarn, type the following command to install Sharetribe CLI:

yarn global add flex-cli

To verify that Sharetribe CLI was successfully installed, run:

flex-cli

This command should show you the CLI version and list available commands.

Didn't work? Have a look at the Troubleshooting.

Help

flex-cli help is the command to see the list of available commands:

flex-cli help

In order to see subcommand help, pass the command as an argument for the flex-cli help command. For example, let's see help for command login.

flex-cli help login

Get an API key

To log in you need to have a personal API key.

To get an API key, log in to Console go to Account > API keys.

Log in

After you've received your API key, you can log in with flex-cli login command. First, let's see help for the login command:

flex-cli help login

You can see that the command does not require any additional options. So let's run it:

flex-cli login

The command will prompt you your API key.

After successful log in, you will be greeted by your admin email address.

Once logged in, you can work with any marketplace that you have been granted access to.

List processes and process versions

Now that you have successfully logged in and know how to use the help command, let's use CLI to list processes and process versions in your marketplace.

The command to list processes is process list. Let's see the help first:

flex-cli help process list

As you can see, the command requires MARKETPLACE_ID option. You can use either the long form --marketplace <marketplace id here> or short form -m <marketplace id here>. You can find the Marketplace ID from Sharetribe Console on the Build > General page. Optionally the command takes --process PROCESS NAME parameter to get detailed information about a single process.

Let's list all the processes:

flex-cli process list -m my-marketplace-dev

This command shows you a list of transaction processes in your marketplace.

Summary

In this tutorial, we installed Sharetribe CLI, logged in using an API key and tried some example commands. In addition, we familiarized ourselves with the help command that is the main source of documentation for the Sharetribe CLI. We also learned how to disable and enable the listing approval functionality for our marketplace.

Now that we know how to list processes, the next this is to make a small change to the existing process.

Troubleshooting

flex-cli: command not found

If you're seeing flex-cli: command not found error and you installed Sharetribe CLI with Yarn, you need to add Yarn global bin path to the PATH environment variable.

On Windows

  1. Run yarn global bin to see the global bin path
  2. Add it to PATH environment variable
  3. Restart command line

For a step-by-step guide with screenshots, have a look at this blog post: 'yarn global add' command does not work on Windows

On Mac

  1. Open your shell configuration file. If you are using zsh, it will be .zshrc.
  2. Add export PATH="$(yarn global bin):$PATH" to the config file.
  3. Restart terminal