mics CLI
The platform is built using an API first approach. You can manage nearly anything using our API. Unfortunately, some actions can require you to use a combination of different APIs, and you'll have to handle authentication for every request.
Using mediarithmics Command Line Interface, you can simplify some actions and you won't have to add authentication headers in every request.

Installation

The CLI for mediarithmics is distributed as an NPM package. To use it, install it globally using
1
npm install -g @mediarithmics-ps/mics-cli
Copied!
You need access to mediarithmics private packages to run this command. Contact us if required.

Getting started

On a fresh install, any command will prompt you for your authentication token. You won't have to enter it anymore.
You can use a command like mics-cli config:list to trigger this prompt.
1
# Run this command on a fresh install
2
mics-cli config:list
3
# The prompt will ask you for MICS API Token
4
# Simply copy/paste it and press enter
5
# The token will be saved and your command will be executed
6
Please enter a value for authToken (MICS API token) : *******
Copied!

Creating an alias

The invoke command is mics-cli. If you prefer something else because it's shorter or just before you want, you can use
1
# Creates an alias for the mics-cli invoke command
2
alias mics="mics-cli"
3
4
# From now, all mics-cli commands can be called with mics
5
mics config:list
Copied!

Config commands

The mics CLI has a set of config commands. They are particularly useful to manage your authentication token.
Lists all your configuration variables.
1
mics-cli config:list
Copied!
Get the value of a configuration variable
1
# mics-cli config:get <VARIABLE>
2
mics-cli config:get authToken
Copied!
Set the value of a configuration variable
1
# mics-cli config:set <VARIABLE> <VALUE>
2
# Will prompt for the value if empty
3
mics-cli config:set authToken
Copied!

Help command

Shows all available commands, and other useful information.
1
mics-cli help
Copied!

Whoami command

Retrieves user information based on the authentication token
1
# The output can be very large,
2
# you may want to save it to a file
3
mics-cli whoami > whoami.txt
Copied!
1
GET /v1/connected_user
2
{
3
"id": "<USER_ID>",
4
"first_name": "<USER_FIRSTNAME>",
5
"last_name": "<USER_LASTNAME>",
6
"email": "<USER_EMAIL>",
7
"locale": null,
8
"workspaces": [
9
{
10
"organisation_id": "<ORG_ID>",
11
"customer_type": "ENTERPRISE",
12
"organisation_name": "<ORG_NAME>",
13
"administrator": false,
14
"role": "CUSTOMER_ADMIN",
15
"community_id": "<COMMUNITY_ID>",
16
"administrator_id": null,
17
"datamarts": [
18
{
19
"id": "<DATAMART_ID>",
20
"name": "<DATAMART_NAME>",
21
"organisation_id": "<ORG_ID>",
22
"token": "<TOKEN>",
23
"creation_date": 1582031749723,
24
"time_zone": "Europe/Paris",
25
"type": "DATAMART",
26
"datafarm": "<DATAFARM>",
27
"storage_model_version": "v201709",
28
"user_point_system_version": "v201901",
29
"region": "EUROPE",
30
"archived": false,
31
"audience_segment_metrics": [...]
32
}
33
]
34
}
35
...
36
]
37
...
38
}
Copied!

Autocomplete

Autocomplete installation instructions can be displayed based on your shell using the autocomplete command.
1
USAGE
2
$ mics-cli autocomplete [SHELL]
3
4
ARGUMENTS
5
SHELL shell type
6
7
OPTIONS
8
-r, --refresh-cache Refresh cache (ignores displaying instructions)
9
10
EXAMPLES
11
$ mics-cli autocomplete
12
$ mics-cli autocomplete bash
13
$ mics-cli autocomplete zsh
14
$ mics-cli autocomplete --refresh-cache
Copied!