Finding the Right Yugabyte Api Endpoint

Page content

As YugabyteDB continues to evolve, its extensive API ecosystem offers powerful capabilities for database management and automation. However, with hundreds of API endpoints across overlapping categories, locating exactly the right API endpoint can be challenging. In this guide, I’ll walk you through several proven strategies for efficiently finding the API endpoints you need, along with real-world examples and pro tips I’ve learned from working with YugabyteDB’s API ecosystem.

Method 1: Navigating Categories in the API Documentation

The API documentation (api-docs.yugabyte.com) provides a well-organized categorical view of available endpoints. Understanding how to navigate these categories effectively will significantly speed up your API discovery process:

Category Deep Dive

Take the Certificate Info category as an example. It includes essential operations like:

  • List a customer’s certificates
  • Restore a certificate from backup
  • Delete a certificate

Yugabyte API List Customer’s Certificates

Understanding category relationships reveals the full scope of available APIs. For example, when working with certificates, looking beyond the Certificate Info category uncovers essential endpoints in Custom CA Certificates. Recognizing these connections helps you find specialized endpoints that might otherwise be overlooked.

Method 2: Strategic Keyword Searching

The search functionality in the API docs is a powerful tool when used strategically. Here’s how to leverage it effectively:

Yugabyte API Docs Search Bar

Understanding Search Result Types

When you search for a term like certificate, you’ll get two types of results:

  • API endpoints (marked with a blue target icon)
  • Schema definitions (marked with an orange cube icon)

Yugabyte API Docs Search Results

Pro Tip: Schema-Based Discovery

Schema results are valuable resources for discovering related API endpoints. For example:

  1. Searching for certificate leads you to the CertificateInfo schema
  2. Within this schema, you might notice words like expiry
  3. Searching for expiry reveals additional APIs in the Custom CA Certificates category
  4. These APIs might offer exactly what you need, even though they weren’t in your initial search results

Method 3: Leveraging the Control Plane UI

If you have access to the YugabyteDB control plane UI, you can use it as a practical API discovery tool. This approach is particularly valuable because the UI uses the same underlying APIs that are available to you programmatically.

Yugabyte Control Plane UI

URL-to-API Mapping

The UI’s URLs often correspond directly to API routes:

  • UI path /universes/api/v1/customers/{cUUID}/universes API endpoint
  • UI path /universes/{uniUUID}/health/api/v1/customers/{cUUID}/universes/{uniUUID}/health_check API

Real-World Example: Certificate Health Monitoring

Let’s walk through a practical example:

  1. In the UI, navigate to the health check display showing certificate validity
  2. Notice the /health route in the URL
  3. Search for “health” in the API docs
  4. Locate the Return results for the last health check API
  5. This API returns a comprehensive JSON object with certificate status data

I’ve created a Jupyter notebook demonstrating how to parse and utilize this health check data effectively. You can find it at the Github repo.

Method 4: Source Code Investigation

For those comfortable with code exploration, examining the open-source codebase can provide valuable insights into available APIs and their implementations.

Focus on the managed section of the yugabyte/yugabyte-db repository on GitHub. Key files to examine:

Searching for backup in the routes reveals:

  • Primary backup API endpoints
  • Related functionality in different modules
  • Implementation details that might inform your API usage

YugabyteDB Open Source Code Search

Advanced Tips and Best Practices

Combining Methods

The most effective approach often involves combining multiple search methods. For example:

  1. Start with category browsing for an overview
  2. Use keyword search to find specific endpoints
  3. Verify functionality through UI correlation
  4. Consult source code for implementation details

API Version Awareness

Remember to check API versions when switching between methods:

  • Documentation typically reflects the latest stable version
  • UI implementations might vary by YugabyteDB version
  • Source code shows both current and upcoming API changes

Conclusion

By using these complementary methods – category browsing, keyword searching, UI investigation, and source code review – you can efficiently locate the exact API endpoints you need. This systematic approach often leads to discovering additional useful endpoints that can make your automation more robust and feature-complete.

Don’t limit yourself to just one search method. The most effective approach is often a combination of these techniques, letting you build a comprehensive understanding of the available APIs and how they can best serve your needs.

Finding the Right YugabyteDB API Endpoint