Debug API

Last updated: 2020-02-21 15:23:16

PDF

Interface description

This API (RunApi) is used to debug API. Users can call this API for debugging after the configuration is completed, and there is no need to wait for publish to go through the formal calling process.

Input Parameter

The following request parameter list only lists the API request parameters. For other parameters, please see Common Request Parameters .

Parameter name Required Type Description
ServiceId Yes String The service on which API is located is the only ID.
ApiId Yes String API unique ID.
RequestHeader No String The request header of the front end of API, which is the data after json_dump
RequestQuery No String The front-end request Query, of API is the data after json_dump
RequestPath No String The request Path, of API is the data after json_dump
RequestMethod No String The request method of API. Only HEAD, GET, POST, PUT, PATCH and DELETE are supported
RequestBody No String Request Body of API
RequestBodyDict No Dict Request Body, of API when API has an input parameter of setting Body type, it is passed in array format
ContentType No String The content type of the debug request. Currently, only application/json and application/x-www-form-urlencoded, are supported. Default is application/x-www-form-urlencoded.

Output Parameter

Parameter name Type Description
Code Int Common error code, 0 indicates success, other values indicate failure. For more information, please see the error code page Common error code
CodeDesc String Error code on the business side. Return the specific cause of the business error when a Success, error is returned on success.
Message String Module error message description, related to interface
ReturnHeader String API's response head
ReturnBody String API's response Packet
ReturnCode Int API's response code
Delay Int API's response delay (in ms)

Example

Modify a API: whose backend service is HTTP
An example of a request is as follows:

https://apigateway.api.qcloud.com/v2/index.php?
&<Common request parameters>
&Action=RunApi
&serviceId=service-XX
&apiId=api-XX
&requestHeader={"headerKey1":"headerValue1","headerKey2":"headerValue2"}
&requestQuery={"queryKey1":"queryValue1","queryKey2":"queryValue2"}
&requestPath={"pathKey1":"pathValue1","pathKey2":"pathValue2"}
&requestMethod=GET
&requestBody=abalabala
&contentType=application/json

The returned results are as below:

{
    "code": "0",
    "message": "",
    "codeDesc": "Success",
    "returnHeader": "abcd",
    "returnBody": "efgh",
    "returnCode": 200,
    "delay": 300
}