Managing Apicurio Registry content using the command-line interface
You can use the Apicurio Registry command-line interface (CLI) to manage Apicurio Registry content from the command line. The CLI provides commands for managing CLI contexts and artifact groups.
|
The CLI is currently in dev-preview status. The CLI supports Linux (bash) and macOS (zsh). Windows is not supported yet. The CLI currently implements only group management commands. Future releases will include additional commands. |
|
The CLI does not yet support authentication. You can only use the CLI with Apicurio Registry instances that do not require authentication. |
-
You have installed Apicurio Registry.
-
You have Java 11 or higher installed.
-
You have access to a bash shell (Linux) or zsh shell (macOS).
Installing the Apicurio Registry CLI
You can install the Apicurio Registry CLI to interact with Apicurio Registry from the command line. The CLI comes as a .zip file that has the executable program and required dependencies.
-
You have Java 11 or higher installed on your system.
-
You have access to a bash shell (Linux) or zsh shell (macOS).
-
Download the latest
apicurio-registry-cli-VERSION.zipfile from the Apicurio Registry GitHub Releases page. Alternatively, you can download the CLI from the Maven Central repository by searching forapicurio-registry-cli. -
Extract the downloaded file to a location of your choice:
$ unzip apicurio-registry-cli-VERSION.zip -d ~/apicurio-cli -
Install the CLI for the current user:
$ cd ~/apicurio-cli $ ./acr installThis command installs the CLI executable to
$HOME/binand creates a configuration directory at$HOME/.apicurio/apicurio-registry-cli. The command also updates your~/.bashrcfile (Linux) or~/.zshrcfile (macOS) and configures shell completions. -
Reload your shell configuration:
On Linux:
$ source ~/.bashrcOn macOS:
$ source ~/.zshrc -
Verify the installation:
$ acr --help
-
For more information, see the CLI README on GitHub.
Configuring Apicurio Registry CLI contexts
An Apicurio Registry CLI context stores the registry URL and identifies the instance that the CLI commands target. You can create many contexts and switch between them as needed, similar to how you use contexts in Kubernetes.
-
Create a new context for your Apicurio Registry instance:
$ acr context create CONTEXT_NAME REGISTRY_URLFor example:
$ acr context create dev http://localhost:8080The CLI automatically switches to the newly created context.
-
List all configured contexts:
$ acr contextExample outputCurrent context is 'default'. ID Registry URL -------- --------------------- default* http://localhost:8080The asterisk (*) indicates the current active context.
-
Optional: Create additional contexts without switching to them:
$ acr context create prod http://registry.example.com --no-switch-current -
Delete a context that you no longer need:
$ acr context delete CONTEXT_NAME
Managing groups using the CLI
You can use the CLI to create, list, update, and delete artifact groups in Apicurio Registry. Groups offer a way to organize related artifacts.
-
You have configured at least one CLI context.
Listing groups
To list all groups in the registry:
$ acr group
You can use pagination options for large result sets:
$ acr group --page 1 --size 50
Creating a group
To create a new group:
$ acr group create GROUP_ID
You can include a description and labels:
$ acr group create my-schemas --description "Production schemas" --label env=prod --label team=platform
Getting group details
To get details for a specific group:
$ acr group get GROUP_ID
For example:
$ acr group get my-schemas
Updating a group
To update a group description:
$ acr group update my-schemas --description "Updated description"
To add or update labels:
$ acr group update my-schemas --set-label env=staging --set-label owner=alice
To delete labels:
$ acr group update my-schemas --delete-label env
Deleting a group
To delete a group:
$ acr group delete GROUP_ID
|
You must configure Apicurio Registry with |
To delete a group that has artifacts, use the --force option:
$ acr group delete my-schemas --force
|
Using |
CLI output formats and pagination
The CLI supports different output formats and pagination options for managing large result sets.
The CLI supports the following output formats:
-
table(default) - Human-readable tabular format -
json- Machine-readable JSON format
To specify the output format, use the --output-type or -o option:
$ acr group --output-type json
$ acr group get my-schemas -o json
For commands that return lists, you can use pagination options:
-
--page- The page number (starting from 1) -
--size- The number of items per page
For example:
$ acr group --page 2 --size 25
CLI reference
The following tables describe CLI global options and exit codes.
The following options are available for most CLI commands:
| Option | Description |
|---|---|
|
Enable verbose output for debugging. |
|
Display help information for the command. |
|
Set the output format. Valid values are |
The CLI uses the following exit codes:
| Code | Description |
|---|---|
0 |
Successful execution. |
1 |
Application error. |
2 |
Input validation error. |
3 |
Apicurio Registry server error. |
The following commands are currently available:
| Command | Description |
|---|---|
|
List all configured contexts. |
|
Create a new context. |
|
Delete a context. |
|
List all groups. |
|
Create a new group. |
|
Get group details. |
|
Update a group. |
|
Delete a group. |
|
Install the CLI for the current user. |
|
Update the CLI to a newer version. |
|
Display CLI version information. |
-
For the latest CLI documentation, see the CLI README on GitHub.
