Skip to main content

Command line

The command line only talks to the admin API — so everything the console does can be scripted and run from a CI. It needs nothing but the URL of the product and a token: neither its databases nor its configuration.

export APIM_URL=https://apim.example.com
export APIM_TOKEN=<a token from the console>
otoroshi-apim help

The same commands, three ways:

The executable — otoroshi-apim <command>the one of the releases, linux and macOS, x64 and arm64: the server and the command line are one program. The examples of this documentation use it
The image — docker run --rm -e APIM_URL -e APIM_TOKEN ghcr.io/cloud-apim/otoroshi-api-management <command>the same executable, for a CI that runs containers; the files it reads (apply -f, portal push) mounted: -v "$PWD:/work" -w /work
From a clone of the repository — mise run cli <command>the url and the token of the local product of the development stack already set
FlagEnvironmentDefault
--urlAPIM_URLhttp://localhost:9000
--tokenAPIM_TOKEN—
-o, --output—table (or json, yaml)

Commands​

Command
whoamithe user behind the token
users list [--q text]the people of the installation (an installation administrator's)
users delete <email|id>a person deleted: their personal applications closed and deleted, their access gone
gateway statusgateway health, projection queue, last drift run, ingestion
gateway setup [--only key,exporter,console,portals,tls] [--dry-run] [--admin-client-id id --admin-client-secret s] [--product-url u] [--exporter-url u] [--console-host h] [--console-auth-module id] [--portal-host h] [--client-auth Want|Need] [--rotate-key]the setup of the gateway, through the admin API
workspaces list
apis list <ws>name, version, lifecycle, gateway state, snapshot, plans, subscriptions
apis get <ws> <api>the declarative document of an API-version
apis changes <ws> <api>what the draft changes since the last snapshot
apis publish <ws> <api> [--comment c] [--deploy]freeze a snapshot, optionally deploy it
apis deploy <ws> <api> [--snapshot n] [--dry-run]deploy the latest (or a given) snapshot; --dry-run prints the catalogue and gateway diffs
apis undeploy <ws> <api>stop serving the API: its Api is disabled on the gateway, its subscriptions and keys kept
apis placement <ws> <api> [--categories a,b] [--featured true|false]where the API stands in the catalogue of the portal, for all its versions
apis reviews <ws> <api>the reviews of its consumers, the hidden ones too
apis snapshots <ws> <api>the snapshot history
apply <ws> -f <file> [--publish] [--deploy] [--managed-by <source>] [--comment c]upsert declarative documents — the content of their pages given by a file is read beside the file
subscriptions list <ws> [--status s] [--api id]
subscriptions accept|reject|suspend|resume|close <ws> <id> [--message m]
subscriptions resync <ws> <id>project the subscription on the gateway again
portal pull <ws> [dir]the design of the portal (its draft) into a folder: portal.yaml, and its pages, templates, style sheet, script and assets beside it (./portal by default)
portal push <ws> [dir] [--publish] [--comment c] [--watch] [--force]the folder into the draft of the design — a version with --publish; --watch pushes again on every change and prints the preview link; the assets the portal holds already are named by their digest, not sent again
portal preview|publish|versions <ws> [--comment c]a link to the draft for an hour, a version from the draft (--comment), the versions
policy-groups list|upgrade <ws> [<group>] [--publish] [--deploy]the shared policy groups, their APIs behind; upgrade moves those to the latest version — their drafts, and on demand their snapshots and deployments
shared-resources list|upgrade <ws> [<resource>] [--publish] [--deploy]the same for the shared resources
dictionaries list|get|set|refresh|delete <ws> [<name>]the dictionaries of a workspace; set -f values.json [--description d] writes a static one
subscriptions ending <ws> <id> <date|none>the end date of a subscription: past, it expires; none renews it
subscriptions usage <ws> <id>the usage billed: the batches of calls sent to the meter of the payment provider
subscriptions transfer <ws> <id> --plan <plan> [--api <api>]to an equivalent plan; a move that waits for the consumer's consent or a payment says so
applications list <ws>the applications, their team and their active subscriptions; their keys, one for every API or one per subscription
drift <ws>run drift detection and print the reports
audit <ws> [--limit n] [--q text]the audit trail
apis export-snapshot <ws> <api> [--snapshot n]a snapshot as a promotion document (default: the deployed one)
promote <ws> -f <file> [--dry-run] [--deploy] [--replace-draft]take a promoted snapshot on this installation
promote <ws> <api> --to <url> --to-token <t> [--to-workspace ws] [--snapshot n] [--dry-run] [--deploy] [--replace-draft]send a snapshot of this installation to the next one
export <ws>the full export, re-importable
import <ws> -f <file>

Round trip​

otoroshi-apim apis get default petstore -o yaml > petstore.yaml
# edit the plans, the resources, the documentation…
otoroshi-apim apply default -f petstore.yaml
otoroshi-apim apis changes default petstore
otoroshi-apim apis deploy default petstore --dry-run
otoroshi-apim apis publish default petstore --comment "from git" --deploy
$ otoroshi-apim apis deploy default petstore --dry-run
dry run: snapshot #3 replaces #2
catalogue changes:
change draft.plans[Discovery].rateLimit.calls
gateway changes:
change plans[Discovery].rate_limiting.window