max-ard
CLI¶
Authentication and API Access¶
The max-ard
CLI has the following tools for authentication and API access:
max-ard login
¶
Usage: max-ard login [--username USERNAME --password PASSWORD]
Configures the local credentials so you don't have to open a text editor. Also can check if you can successfully access the api.
Setting up credentials¶
The ARD tools store credentials in a file in your home directory call .ard-config
. This file can be created manually with a text editor and should have the following format:
[ard]
user_name = <your username>
user_password = <your password>
The CLI can generate this file for you if it does not exist. The CLI will prompt you for values if not provided any values:
max-ard login
To set or update your username and/or password, you can pass the values via parameters:
% max-ard login --username <username> --password <password>
... Creating config file ~/.ard-config
... Checking access
ARD access confirmed
To check that your credentials work and you can log in successfully, you can run:
% max-ard login
ARD access confirmed
max-ard token
¶
Usage: max-ard token [--reset, -r]
Getting an access token¶
To communicate with the API you must send an access token with your request. While this can be done from the API the CLI also can fetch and return a token:
% max-ard token
<long token>
This can be useful for inline command substitution in other commands. Instead of copying and pasting the token you can insert the max-ard token
command. This shows sending the token in a request using curl
:
curl -H 'Accept: application/json' \\
-H "Authorization: Bearer $(max_ard token)" \\
https://ard.maxar.com/api/select/request/<request ID>
Resetting the access token¶
You can use the CLI to reset your token (remove it from your ARD configuration file):
% max-ard token --reset
or
% max-ard token -r
If reset is successful, you will see:
Token reset
max-ard account
¶
Usage: max-ard account
This command shows basic account for the current user.
% max-ard account
Account ID: ##
User ID: ##
User Name: ##
User Email: ##
Usage Limits:
Area: ## sq.km
Subscription: $##
Fresh Imagery: $##
Standard Imagery: $##
Training Imagery: $##
max-ard usage
¶
Usage: max-ard account [--user USER ID --account ACCOUNT ID --start-date START DATE --end-date END DATE]
Shows usage data for an account or user. Optional start and end dates should be formatted as YYYY-MM-DD.
Will run interactively if not supplied with parameters.
% max-ard usage
Get usage for an [a]ccount or [u]ser? u
User ID [current user]?
Start date YYYY-MM-DD [none]?
End date YYYY-MM-DD [none]?
Data Usage
----------
Account limit: ## sq.km ($##)
Imagery ordered: ## sq.km ($##)
├ Fresh (< 90 days): ## sq.km ($##)
├ Standard (90 days - 3 years): ## sq.km ($##)
└ Training (> 3 years): ## sq.km ($##)
Remaining balance: ## sq.km ($##)