> [!WARNING]
>
> **Preview**
>
>
> This product or feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section
> of the [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA products and features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

This document shows you how to view the details of a schema registry resource
within Managed Service for Apache Kafka. You can view details such as its configuration,
associated contexts, and subjects.

You can't use the open source Apache Kafka client APIs to view these specific
Managed Service for Apache Kafka schema registry resource details.

## Required roles and permissions


To get the permissions that
you need to view a schema registry,

ask your administrator to grant you the
[Managed Kafka Schema Registry Viewer](https://docs.cloud.google.com/iam/docs/roles-permissions/managedkafka.md.txt#managedkafka.schemaRegistryViewer) (`roles/managedkafka.schemaRegistryViewer`) IAM role on the schema registry instance.


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


This predefined role contains

the permissions required to view a schema registry. To see the exact permissions that are
required, expand the **Required permissions** section:


#### Required permissions

The following permissions are required to view a schema registry:

- Grant this permission on the schema registry resource: `managedkafka.schemaRegistries.get`


You might also be able to get
these permissions
with [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles.md.txt) or
other [predefined roles](https://docs.cloud.google.com/iam/docs/roles-overview.md.txt#predefined).

## View schema registry details

To retrieve the configuration and details of a specific schema registry, follow
these steps:

### Console

1. In the Google Cloud console, go to the **Schema registries** page.

   [Go to schema registries](https://console.cloud.google.com/managedkafka/schemaRegistries)

   A list of schema registries in your project is displayed.
2. Click the name of the schema registry whose details you want to view. The **Schema registry details** page opens. The information displayed on
   this page is explained in the [Schema registry page details](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/schema-registry/view-schema-registry.md.txt#schema-registry-page-details) section.

### gcloud

1.
   [Install](https://docs.cloud.google.com/sdk/docs/install) the Google Cloud CLI.

   After installation,
   [initialize](https://docs.cloud.google.com/sdk/docs/initializing) the Google Cloud CLI by running the following command:

   ```bash
   gcloud init
   ```


   If you're using an external identity provider (IdP), you must first
   [sign in to the gcloud CLI with your federated identity](https://docs.cloud.google.com/iam/docs/workforce-log-in-gcloud.md.txt).
2. To retrieve the configuration and details of a specific schema registry, run the [`gcloud beta managed-kafka schema-registries describe`](https://docs.cloud.google.com/sdk/gcloud/reference/beta/managed-kafka/schema-registries/describe) command:

```bash
gcloud beta managed-kafka schema-registries describe SCHEMA_REGISTRY_ID \
    --location=LOCATION \
```
3. Replace the following:
   - <var translate="no">SCHEMA_REGISTRY_ID</var> (required): the ID of the schema registry you want to describe.
   - <var translate="no">LOCATION</var> (required): the Google Cloud region where the schema registry is located.

For example, the following command gets the details of a schema
registry called `test_SR` located in the
region `us-central1`:

```bash
gcloud beta managed-kafka schema-registries describe test_SR \
    --location=us-central1
```

The command returns the output similar to the following:

```bash
Describing schema registry: projects/test-pubsub/locations/us-central1/schemaRegistries/test_SR
name: projects/test-pubsub/locations/us-central1/schemaRegistries/test_SR
mode: READWRITE
config:
  - compatibility: BACKWARD
contexts:
  - projects/test-pubsub/locations/us-central1/schemaRegistries/test_SR/contexts/.
  - projects/test-pubsub/locations/us-central1/schemaRegistries/test_SR/contexts/user-record
```

### REST

- To retrieve the details of a specific schema registry instance using the REST API, make a `GET` request to the following URI:

```
GET https://managedkafka.googleapis.com/v1main/projects/PROJECT_ID/locations/LOCATION/schemaRegistries/SCHEMA_REGISTRY_ID
Authorization: Bearer $(gcloud auth application-default print-access-token)
```
- Replace the following:
  - <var translate="no">PROJECT_ID</var> (required): your Google Cloud project ID.
  - <var translate="no">LOCATION</var> (required): the region where the schema registry exists.
  - <var translate="no">SCHEMA_REGISTRY_ID</var> (required): the unique ID of the schema registry that you want to view.

If the request is successful, the API returns a `200 OK` status
code. The response body contains a JSON object representing the details of
the requested schema registry.

For example, the following is a response to a command to get the details of a schema
registry called `gcloud_test` located in the region `us-central1`:

```json
{
  "name": "projects/testing-311516/locations/us-central1/schemaRegistries/gcloud_test",
  "contexts": [
    "projects/testing-311516/locations/us-central1/schemaRegistries/gcloud_test/contexts/default",
    "projects/testing-311516/locations/us-central1/schemaRegistries/gcloud_test/contexts/."
  ]
}
```

For more information, see the
[REST API documentation](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/reference/rest.md.txt).

<br />

## Schema registry page details

When you view a schema registry in the Google Cloud console, the
**Schema registry details** page displays the following information for the
selected registry:

- **Region**: the Google Cloud region where the registry resides.
- **Schema registry URL** : the endpoint URL for the schema registry. This is of the format `https://managedkafka.googleapis.com/v1main/projects/PROJECT_ID/locations/LOCATION/schemaRegistries/SCHEMA_REGISTRY_ID`.

  For example---`https://managedkafka.googleapis.com/v1main/projects/managed-kafka-project/locations/us-central1/schemaRegistries/testschemaregistry`
- **Schema mode**: the operational mode that you can set at the schema registry level and the individual subject level. This setting controls whether modifications can be made.
- **Compatibility type** : the registry-level configuration for the default compatibility setting enforced for new subjects or schema versions within this registry (unless overridden at the subject or context level). Common values include `BACKWARD`, `FORWARD`, `FULL`, or `NONE`.
- **Subjects in this schema registry**: a list of subject names associated with the registry. If a context is available, you can also view the context for each subject.

*Apache Kafka® is a registered
trademark of The Apache Software Foundation or its affiliates in the United
States and/or other countries.*