Search code examples
azureazure-eventhub

How can I get my schema(from Azure Schema Registry) through Postman?


I am trying to get the schema from Azure Schema Registry. Is there any possibility to communicate with Schema Registry through REST API?


Solution

  • If you want to get the schema from the schema group in one event hub namespace, please refer to the following steps

    1. Create a service principal and assign Azure RABC role Schema Registry Reader to the sp. For more details, please refer to the official document
    az ad sp create-for-rbac -n "MyApp" --role "Schema Registry Reader"  --scope <the scope according to your need>
    
    1. Get token
    POST https://login.microsoftonline.com/<tennat id>/oauth2/v2.0/token
    
    Content-Type: application/x-www-form-urlencoded
    
    grant_type=client_credentials
    &client_id=
    &client_secret=
    &scope=https://eventhubs.azure.net/.default
    
    1. Call API

    a. list schema group

    https://<namespace name>.servicebus.windows.net/$schemagroups?api-version=2020-09-01-preview
    
    Authorization: Bearer <token>
    

    enter image description here

    b. list schemas in one group

    https://<namespace name>.servicebus.windows.net/$schemagroups/<group name>/schemas?api-version=2020-09-01-preview
    
    Authorization: Bearer <token>
    

    enter image description here

    c. get one schema

    https://<namespace name>.servicebus.windows.net/$schemagroups/<group name>/schemas/<>?api-version=2020-09-01-preview
    
    Authorization: Bearer <token>
    

    enter image description here

    enter image description here