Get API Details

By using the API ID, you can obtain detailed information about a specific API, including the complete OpenAPI definition (request parameters and response formats).

This interface does not require authentication.

Interface Description

  • Request Method: GET
  • Request URL: https://platform.acedata.cloud/api/v1/apis/{api_id}/
  • Request Headers:
    • accept: application/json

Where {api_id} is the UUID of the API.

CURL Request Example

curl -X GET \
  -H "accept: application/json" \
  "https://platform.acedata.cloud/api/v1/apis/{api_id}/"

Example of Returned Result

{
  "id": "api-uuid",
  "name": "Midjourney Imagine",
  "title": "Midjourney Imagine",
  "path": "/v1/midjourney/imagine",
  "path2": null,
  "stage": "Production",
  "cost": [
    {
      "conditions": {},
      "consumption": 4.95
    }
  ],
  "definition": {
    "openapi": "3.0.1",
    "info": {
      "title": "Midjourney Imagine API",
      "version": "1.0.0"
    },
    "paths": {
      "/v1/midjourney/imagine": {
        "post": {
          "summary": "Midjourney Image Generation",
          "requestBody": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "prompt": { "type": "string", "description": "Generation prompt" }
                  }
                }
              }
            }
          },
          "responses": {
            "200": { "description": "Generation successful" },
            "400": { "description": "Request parameter error" },
            "401": { "description": "Authentication failed" },
            "429": { "description": "Too many requests" }
          }
        }
      }
    }
  },
  "visible_models": null,
  "service_id": "service-uuid",
  "document_id": "doc-uuid",
  "created_at": "2024-01-01T00:00:00.000000Z",
  "updated_at": "2024-08-01T00:00:00.000000Z"
}

How to Use the OpenAPI Definition

The definition field contains the complete OpenAPI 3.0 specification definition. You can utilize this definition:

  1. Understand request parameters: Check the parameter definitions in pathsrequestBodyschema.
  2. Understand response formats: Check the response structure in pathsresponses.
  3. Generate client code: Import the definition into Swagger/OpenAPI tools to automatically generate calling code.
  4. Integrate into API testing tools: Import into tools like Postman, Insomnia, etc., for testing.

Code Example

Python:

import requests

api_id = "api-uuid"
url = f"https://platform.acedata.cloud/api/v1/apis/{api_id}/"
headers = {"accept": "application/json"}

response = requests.get(url, headers=headers)
api = response.json()

print(f"API Name: {api['name']}")
print(f"Calling Path: {api['path']}")
print(f"Release Stage: {api['stage']}")

# Parse OpenAPI definition
definition = api["definition"]
if definition and "paths" in definition:
    for path, methods in definition["paths"].items():
        for method, spec in methods.items():
            print(f"  {method.upper()} {path}: {spec.get('summary', '')}")