Skip to content

registry get

Tim Burks edited this page Jan 21, 2023 · 3 revisions

Modeled on kubectl get, registry get allows command-line users to list and read contents of the registry.

registry get PATTERN returns a list of all resources with names matching PATTERN, and by default just the names are returned. If the -o yaml option is added, results are returned in a YAML format that can be used to reimport information into the registry. If the -o contents option is instead added, the raw contents fields of resources with contents (specs and artifacts) are returned. Note that -o contents requires that PATTERN match a single resource.

The following examples assume that a project named favs exists and that the registry tool is configured to point to it with registry config set registry.project favs:

$ registry get apis
projects/favs/locations/global/apis/translate
projects/favs/locations/global/apis/wordnik.com

$ registry get apis/-/versions
projects/favs/locations/global/apis/translate/versions/v2
projects/favs/locations/global/apis/translate/versions/v3
projects/favs/locations/global/apis/translate/versions/v3beta1
projects/favs/locations/global/apis/wordnik.com/versions/4.0

$ registry get apis/-/versions/-/specs
projects/favs/locations/global/apis/translate/versions/v2/specs/discovery
projects/favs/locations/global/apis/translate/versions/v3/specs/discovery
projects/favs/locations/global/apis/translate/versions/v3/specs/google-cloud-translate-v3
projects/favs/locations/global/apis/translate/versions/v3beta1/specs/discovery
projects/favs/locations/global/apis/translate/versions/v3beta1/specs/google-cloud-translate-v3beta1
projects/favs/locations/global/apis/wordnik.com/versions/4.0/specs/openapi

$ registry get apis/wordnik.com/versions/4.0/specs/openapi -o yaml
apiVersion: apigeeregistry/v1
kind: Spec
metadata:
  name: openapi
  parent: apis/wordnik.com/versions/4.0
data:
  filename: openapi.yaml
  mimeType: application/x.openapi+gzip;version=3
  sourceURI: https://github.com/APIs-guru/openapi-directory/blob/906e7005dfc89eb68faed21521e328e6ba16b291/APIs/wordnik.com/4.0/openapi.yaml

$ registry get apis/wordnik.com/versions/4.0/specs/openapi -o contents | head -7
openapi: 3.0.0
servers:
  - url: https://api.wordnik.com/v4
info:
  description: Wordnik is the worlds biggest online English dictionary, by number of words
  title: Wordnik
  version: "4.0"