Updated on 2022-09-15 GMT+08:00

Debugging an API

Description

This API is used to debug an API.

URI

  • URI format

    POST /v1/{project_id}/service/apis/{api_id}/instances/{instance_id}/test

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID. For details about how to obtain the project ID, see Project ID and Account ID.

    api_id

    Yes

    String

    api id

    instance_id

    Yes

    String

    Instance ID.

    For DLM Shared, the instance ID is APIG.

    For DLM Exclusive, the instance ID is the cluster ID.

    body

    Yes

    JSON

    Body of the debugging API (depending on the API definition). For example, if parameter a is defined in the API and its value is 1, the body is {"a":1}.

Request Message

  • Example request
    {
        "paras": {
            "page_size": "10",
            "page_num": "1"
        }
    }

Response

  • Example response
    {
        "request_header": {
            "path": "GET /testApi/1 HTTP",
            "user_agent": "DLMDebugClient/1.0",
            "x_apig_mode": "DEBUG",
            "x_app_identity": 1
        },
        "request_id": "704742365000242752",
        "response_header": {
            "cache_control": "private",
            "connection": "keep-alive",
            "content_length": 2,
            "content_type": "application/json;charset=UTF-8",
            "date": "Tue Apr 28 17:14:37 GMT+08:00 2020",
            "result_status": "HTTP 200 Success",
            "x_request_id": "704742365000242752"
        },
        "result": "[]",
        "success": true,
        "timecost": 3826,
        "url": "/testApi/1"
    }
  • Response parameter description

    Parameter

    Type

    Description

    request_id

    String

    Request ID

    url

    String

    Request URL

    result

    String

    Debugging result

    timecost

    Long

    Debugging duration in milliseconds

    success

    Boolean

    Whether the debugging is successful

    request_header

    Dictionary

    Request header

    response_header

    Dictionary

    Response header

    • request_header parameters

      Parameter

      Type

      Description

      path

      String

      Request path

      user_agent

      String

      Proxy (fixed value)

      x_apig_mode

      String

      Request mode (fixed value)

      x_app_identity

      Integer

      Identification No. (fixed value)

    • response_header parameters

      Parameter

      Type

      Description

      result_status

      String

      Whether the operation succeeded

      content_length

      Integer

      Content length

      connection

      String

      Connection status

      cache_control

      String

      Cache control (fixed value)

      content_type

      String

      Content type (fixed value)

      date

      String

      Date

      x_request_id

      String

      Request ID

Status Code

Status Code

Description

200

The status code 200 is returned regardless of whether the operation succeeds or fails. The status code only indicates that the debugging request is submitted successfully. For details about whether the debugging is successful, see the corresponding structure.

For details about status codes, see Status Codes.