List schema revisions for a topic

This document shows you how to list the revisions of a schema for Pub/Sub topics.

Before you begin

Required roles and permissions

To get the permissions that you need to list schema revisions and manage them, ask your administrator to grant you the Pub/Sub Editor (roles/pubsub.editor) IAM role on your project. For more information about granting roles, see Manage access to projects, folders, and organizations.

This predefined role contains the permissions required to list schema revisions and manage them. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to list schema revisions and manage them:

  • Create schema: pubsub.schemas.create
  • Attach schema to topic: pubsub.schemas.attach
  • Commit a schema revision: pubsub.schemas.commit
  • Delete a schema or a schema revision: pubsub.schemas.delete
  • Get a schema or schema revisions: pubsub.schemas.get
  • List schemas: pubsub.schemas.list
  • List schema revisions: pubsub.schemas.listRevisions
  • Rollback a schema: pubsub.schemas.rollback
  • Validate a message: pubsub.schemas.validate
  • Get the IAM policy for a schema: pubsub.schemas.getIamPolicy
  • Configure the IAM policy for a schema: pubsub.schemas.setIamPolicy

You might also be able to get these permissions with custom roles or other predefined roles.

You can grant roles and permissions to principals such as users, groups, domains, or service accounts. You can create a schema in one project and attach it to a topic located in a different project. Ensure that you have the required permissions for each project.

List the revisions of a schema

You can list the revisions of a schema in a Google Cloud project using the Google Cloud console, the gcloud CLI, the Pub/Sub API, or the Cloud Client Libraries.

Console

  1. In the Google Cloud console, go to the Pub/Sub schemas page.

    Go to Schemas

    The list of schemas is displayed.

  2. Click the name of the schema that you want to view.

    The Schema details page for the schema opens.

    In the Revisions section, you can see the list of available revisions for the schema.

gcloud

To view the latest revision for a schema:

gcloud pubsub schemas list-revisions SCHEMA_ID

Use the gcloud pubsub schemas list-revisions <var>SCHEMA_ID</var> --view=FULL command to see the definitions for the schema revisions.

REST

To list the schema revisions for a schema, send a GET request like the following:

GET https://pubsub.googleapis.com/v1/projects/SCHEMA_NAME:listRevisions

If successful, the response body contains a