Back to Yugabyte Db

List Providers

managed/api-examples/python-simple/list-providers.ipynb

2026.1.0.0-b251.1 KB
Original Source

Setup

First, import the required packages.

Next, specify some important variables:

  • platform_address: The address of the Yugabyte Platform API
  • platform_api_key: The API key used to authenticate with the Platform API

Finally, open a HTTP connection to the Yugabyte Platform API.

python
import os
import http.client
import json

platform_address = 'localhost:9000'
platform_api_key = os.getenv('YB_API_KEY')

conn = http.client.HTTPConnection(f"{platform_address}")

headers = {
  'Content-Type': "application/json",
  'X-AUTH-YW-API-TOKEN': f"{platform_api_key}"
}

Get Session Info

Make an API call to session endpoint to determine customer UUID.

python
conn.request("GET", "/api/v1/session_info", headers=headers)

res = conn.getresponse()
data = res.read()
session_info = json.loads(data)
customer_uuid = session_info['customerUUID']

print('Customer UUID:\n%s' % customer_uuid)

List Providers

Make API call to provider endpoint to list providers.

python
url = f"/api/v1/customers/{customer_uuid}/providers"
conn.request("GET", url, headers=headers)
res = conn.getresponse()
print(json.dumps(json.load(res), indent=2))