Skip to content

Latest commit

 

History

History
83 lines (70 loc) · 2.96 KB

File metadata and controls

83 lines (70 loc) · 2.96 KB

API Generation and Consumption

This document explains how APIs are generated for data products in IBM Data Product Hub (DPH) and how they can be consumed by AI agents and applications.

API Generation

Step 1: Data Product Registration

  • Once the CI/CD pipeline publishes the data product to DPH, the platform automatically registers the data product.
  • The registration process includes:
    • Storing the contract metadata.
    • Validating the semantic query.
    • Applying the specified policy (e.g., internal_only).

Step 2: API Exposure

  • DPH generates a governed API endpoint for the data product.
  • Example API endpoint:
    GET /metrics/invoice_collection_risk_14d
    
  • The API is governed by the policies defined in the contract (e.g., access control, data masking).

Step 3: OpenAPI Specification

  • DPH automatically generates an OpenAPI specification for the API.
  • Example OpenAPI snippet:
    openapi: 3.0.0
    info:
      title: Invoice Collection Risk (14 Days)
      description: API for retrieving the value of unpaid invoices due within 14 days.
      version: 1.0.0
    paths:
      /metrics/invoice_collection_risk_14d:
        get:
          summary: Retrieve invoice collection risk
          responses:
            '200':
              description: Successful response
              content:
                application/json:
                  schema:
                    type: object
                    properties:
                      value:
                        type: number
                        description: Total value of unpaid invoices due within 14 days.

API Consumption

Step 1: Querying the API

  • Applications and AI agents can query the API to retrieve the data product's metric.
  • Example query:
    curl -X GET https://dph.example.com/metrics/invoice_collection_risk_14d \
      -H "Authorization: Bearer <token>"

Step 2: AI Agent Integration

  • AI agents (e.g., Claude, ChatGPT) can use the API to answer user queries.

  • Example user query:

    What is the invoice collection risk over the next 14 days?

  • Example agent response:

    The invoice collection risk over the next 14 days is $1,250,000.

Step 3: Policy Enforcement

  • The API enforces the policies defined in the contract:
    • Access Control: Ensures only authorized users can access the API.
    • Data Masking: Applies masking to sensitive fields if required.

Step 4: Real-Time Updates

  • The API provides real-time data based on the semantic query.
  • Example:
    • If new invoices are added to the database, the API reflects the updated metric immediately.

Benefits

  • Governance: Ensures data access complies with organizational policies.
  • Automation: Eliminates manual API creation.
  • Integration: Enables seamless consumption by AI agents and applications.

Summary

  • DPH automates the generation of governed APIs for data products.
  • These APIs can be consumed by AI agents and applications to provide real-time insights while enforcing governance policies.