Skip to content

APImetrics/APIm-CLI

Repository files navigation

APImetrics CLI

An easy way to interact with APImetrics, the unbiased SaaS Platform ensuring API products perform as agreed, are secure, meet business objectives, and comply with regulations.

Install

Requirements

Networking

The CLI will require an internet connection that allows access to the following domains in order to function properly. If you are adding firewall rules to allow this, we highly suggest that your firewall is configured to refresh the IP addresses for the domains on a regular basis as they may change without prior notice.

Domain Ports
client.apimetrics.io 80, 443
auth.apimetrics.io 80, 443

Supported OS and Architectures

Both x64 and ARM architectures are supported with the following operating systems:

OS Supported
Windows 11
Windows 10
Windows 7
Linux
macOS

Supported Node.js Versions

We support all current and LTS versions of Node.js. When a version moves to end-of-life, we will drop support. If you are currently using a version of Node.js that is currently end-of-life, we suggest you upgrade to a newer version. More information about currently supported Node.js versions is published by the Node.js Release Working Group.

Version Supported
21.x
20.x
18.x
16.x

Methods

Using npm

The CLI is built with Node.js and can be installed using npm. In order to use this method, you must have node and npm installed on your system already. You can find download instructions here. To download run the following command:

npm install -g @apimetrics/cli

Using Tarballs

These are standalone distributions containing their own Node.js binary and the CLI. They do not require any other software to already be installed on your system.

The tarballs are available in both gz and xz formats. xz is much smaller so ideal for slow connections, however gz has wider support from decompression software. If you are unsure of which to use, use gz.

To find the latest version of your desired tarball, go to our latest release.

Once you have downloaded the tarball for your system, you should then extract to a location such as /usr/local/bin/apimetrics and ensure that this location is on your PATH.

Usage

$ npm install -g @apimetrics/cli
$ apimetrics COMMAND
running command...
$ apimetrics (--version)
@apimetrics/cli/0.3.0 linux-x64 node-v21.0.0
$ apimetrics --help [COMMAND]
USAGE
  $ apimetrics COMMAND
...

Login

To start using the APImetrics CLI, you must log into your account. If you don't have an account with APImetrics, you can sign up here. To log in, run the following command:

apimetrics login

You will be redirected to a page in your browser with a code. Check this code is the same as the code displayed in your APImetrics CLI. If they are, click confirm. If you have multi-factor authentication enabled for APImetrics, you will be asked to input your one-time code. After this, you will be logged in and be able to return to your CLI.

Now that you are logged in, the CLI will ask you to select one of the Organizations you are part of to work on. Once this is selected, it will ask you to select the Project you want to work on. Now you are ready to start with your CLI.

Command Topics

Environment Variables

Name Required Description
APIMETRICS_API_URL Base URL for the API. Defaults to https://client.apimetrics.io/api/2/.
APIMETRICS_AUTH_SERVER OIDC server to use for login. Defaults to https://auth.apimetrics.io.
APIMETRICS_CLIENT_ID Client ID to use for OAuth based login.
APIMETRICS_CONFIG_DIR Directory to store configuration for the CLI. Defaults to ~/.config/apimetrics on UNIX and %LOCALAPPDATA%\apimetrics on Windows.
XDG_CONFIG_HOME Directory to store configuration for the CLI. Not recommended for use. Use APIMETRICS_CONFIG_DIR instead. APIMETRICS_CONFIG_DIR takes priority if also set.