registry
is a command-line tool for working with the Registry API that
provides a mixture of high-level capabilities and automatically-generated
subcommands that call methods of the Registry API.
Run registry help
for general information and registry help [subcommand]
for
details on any subcommand.
registry
is configured with environment variables that are set by
authorization scripts in the auth directory of this project. This
includes the address of the Registry API server and authentication tokens.
Release builds of the registry
tool are available on GitHub and can be found
in
github.com/apigee/registry/releases.
MacOS note: To run the registry
tool on MacOS, you may need to
unquarantine it by running the
following on the command line:
xattr -d com.apple.quarantine registry
This will download and install the latest version of the registry
tool (on
Linux or Darwin):
curl -L https://raw.githubusercontent.com/apigee/registry/main/downloadLatest.sh | sh -
To use the registry
tool with a hosted instance associated with Apigee API
hub, please do the following:
- Make sure you have gcloud command installed.
- Set the
PROJECT_ID
environment variable to your API hub project name. - Configure
gcloud
to use your project:
gcloud config set project $PROJECT_ID
- Run the following script to get an authorization token and set it in your
environment as
$REGISTRY_TOKEN
(on Windows, please useauth/HOSTED.bat
):
. auth/HOSTED.sh
- To list all the APIs in your API hub instance run the following:
registry get projects/$PROJECT_ID/locations/global/apis/-
- To see other supported commands, run the following:
registry help
The registry
tool currently includes several demonstration subcommands that
upload API descriptions into a registry and one subcommmand (registry apply
)
that is likely to become a recommended way to populate an API registry.
-
registry upload openapi
reads OpenAPI descriptions from a directory that follows the style of the APIs-guru/openapi-directory repository. To try it, clone theopenapi-directory
repo, change your directory to the repo, and run theregistry upload openapi
command as follows:git clone https://github.com/apis-guru/openapi-directory cd openapi-directory registry upload openapi APIs --project-id $PROJECT_ID
Here
APIs
is a directory in the repo and$PROJECT_ID
should be set to your registry project id. -
registry upload protos
reads Protocol Buffer API descriptions from a directory that follows the style of the googleapis/googleapis repository. To try it, clone thegoogleapis
repo, change your directory to the root of the repo, and run theregistry upload protos
command as follows:git clone https://github.com/googleapis/googleapis cd googleapis registry upload protos . --project-id $PROJECT_ID
As above,
$PROJECT_ID
should be set to your registry project id. -
registry upload discovery
reads API descriptions from the Google API Discovery Service. This reads from an online service, so you can try it by simply running the following:registry upload discovery --project-id $PROJECT_ID
As above,
$PROJECT_ID
should be set to your registry project id. -
registry apply
reads API information from YAML files using a mechanism similar tokubectl apply
. For details, check the wiki entry To try it, run the following from the root of theregistry
repo:registry apply -f cmd/registry/cmd/apply/testdata/registry.yaml --parent projects/$PROJECT_ID/locations/global