Query API's information

Last updated: 2020-02-21 15:21:40

Interface description

This API (DescribeApi) is used to query the details of API deployed in the API gateway. Yoo

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 only ID for the service in which API resides
ApiId Yes String API's only ID

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
ServiceId String The only ID for the service in which API resides
ServiceName String Name of the service where API is located
ServiceDesc String Description of the service in which the API resides
ApiId String API's only ID
ApiDesc String API's description
ApiName String The name of API
CreatedTime Timestamp Creation time, expressed according to the ISO8601 standard, and using UTC time. Format: YYYY-MM-DDThh:mm:ssZ
ModifiedTime Timestamp The last modification time is expressed according to the ISO8601 standard, and the UTC time is used. Format: YYYY-MM-DDThh:mm:ssZ
RequestConfig Array Front-end configuration Dictionary of API
RequestParameters Array Front-end parameter array of API
ServiceType String Three backend service types of API are now supported: HTTP,MOCK,SCF
ServiceTimeout Int API's backend service timeout (in S)
ServiceConfig Array API's backend configuration dictionary. This parameter is available only if the backend service type is HTTP.
ServiceParameters List of Arrays An array of backend service parameters for API. This parameter is available only if serviceType is HTTP.
ConstantParameters List of Arrays An array of constant parameters for the backend service of API. This parameter is available only if serviceType is HTTP.
ServiceMockReturnMessage String The backend Mock of API returns information. This parameter is available only if serviceType is Mock.
ServiceScfFunctionName String The name of the backend Scf function of the API. This parameter is available only if serviceType is Scf.
AuthRequired String Whether you need to sign Verification. TRUE: yes, FALSE: no.
EnableCORS String Whether it is necessary to enable cross-domain. TRUE means it is necessary, and FALSE means it is not required.
ResponseType String Custom response configuration return type. Only HTML, JSON, TEST, BINARY and XML are supported.
ResponseSuccessExample String Custom response configuration successful response example
ResponseFailExample String Custom response configuration failure response example
ResponseErrorCodes List of Arrays Custom response configuration error code message

The composition of the frontend configuration requestConfig is as follows:

Parameter name Type Description
Path String The front-end path of API, such as / path
Method String The front-end request method of API, such as GET

The frontend parameter requestParameters is an array of requestParameter, and requestParameter is composed as follows:

Parameter name Type Description
Name String The name of the frontend parameter of API
In String The location of the frontend parameters of API, such as head
Type String The frontend parameter type of API, such as String
DefaultValue String Default values of frontend parameters for API
Required Boolean Whether the frontend parameters of API are required. REQUIRED: means required, and OPTIONAL: means optional.
Desc String Remarks on the frontend parameters of API

When the backend service type serviceType of API is HTTP, the backend configuration serviceConfig is composed as follows:

Parameter name Type Description
Url String URL, the back-end service of API
Path String The backend service path of API, such as / path
Method String API's backend service request method, such as GET

The backend parameter serviceParameters is an array of serviceParameter. The composition of serviceParameter is as follows:

Parameter name Type Description
Name String Backend service parameter name of API
Position String Location of backend service parameters of API, such as head
RelevantRequestParameterName String The name of the frontend parameter corresponding to the backend service parameter of API
RelevantRequestParameterIn String The location of the frontend parameters corresponding to the backend service parameters of API, such as head
Desc String Remarks on backend service parameters of API

The constant parameter constantParameters is an array of constantParameter. The composition of constantParameter is as follows

Parameter name Type Description
Name String Constant parameter name
Desc String Constant parameter description
Position String Constant parameter position
DefaultValue String Constant parameter default value

Example

Query the details of API whose back end is HTTP service:

An example of a request is as follows:

https://apigateway.api.qcloud.com/v2/index.php?
&<Common request parameters>
&Action=DescribeApi
&serviceId=service-XX
&apiId=api-XX

The returned results are as below:

{
    "code": "0",
    "message": "",
    "codeDesc": "Success",
    "serviceId": "service-XX",
    "serviceName": "test",
    "serviceDesc": "testDesc",
    "apiId": "api - XX",
    "apiName": "apiXXXX",
    "apiType": "NORMAL",
    "apiDesc": "myHTTPTestApi",
    "createdTime": "2017-08-07T00:00:00Z",
    "modifiedTime": "2017-08-07T00:00:00Z",
    "requestConfig": {
        "path": "/path",
        "method": "GET"
    },
    "requestParameters": [{
        "name": "age",
        "in": "HEADER",
        "type": "Int",
        "defaultValue": 18,
        "required": "True",
        "desc": "age "
    }],
    "serviceType": "HTTP",
    "serviceTimeout": 60,
    "serviceConfig": {
        "url": "cloud.tencent.com",
        "path": "/path",
        "method": "GET"
    },
    "serviceParameters": [{
        "name": "age",
        "in": "HEADER",
        "relevantRequestParameterName": "age",
        "relevantRequestParameterIn": "HEADER",
        "defaultValue": 18,
        "desc": "age"
    }]
}

Query the details of API whose backend is MOCK:

An example of a request is as follows:

https://apigateway.api.qcloud.com/v2/index.php?
&<Common request parameters>
&Action=DescribeApi
&serviceId=service-XX
&apiId=api-XXX

The returned results are as below:

{
    "code": "0",
    "message": "",
    "codeDesc": "Success",
    "serviceId": "service-XX",
    "serviceName": "test",
    "serviceDesc": "testDescription",
    "apiId": "api - XXX",
    "apiName": "apiXXXX",
    "apiType": "NORMAL",
    "apiDesc": "myMockTestApi",
    "createdTime": "2017-08-07T00:00:00Z",
    "modifiedTime": "2017-08-07T00:00:00Z",
    "requestConfig": {
        "path": "/path",
        "method": "GET"
    },
    "requestParameters": [{
        "name": "age",
        "in": "HEADER",
        "type": "Int",
        "defaultValue": 18,
        "required": "REQUIRED",
        "desc": "age"
    }],
    "serviceType": "MOCK",
    "serviceTimeout": 60,
    "serviceMockReturnMessage": "Returned message from MOCK"
}

Query the details of API whose backend is SCF:

An example of a request is as follows:

https://apigateway.api.qcloud.com/v2/index.php?
&<Common request parameters>
&Action=DescribeApi
&serviceId=service-XX
&apiId=api-XXXX

The returned results are as below:

{
    "code": "0",
    "message": "",
    "codeDesc": "Success",
    "serviceId": "service-XX",
    "serviceName": "test",
    "serviceDesc": "testDescription",
    "apiId": "api-XXXX",
    "apiName": "apiXXXX",
    "apiType": "NORMAL",
    "apiDesc": "mySCFTestApi",
    "createdTime": "2017-08-07T00:00:00Z",
    "modifiedTime": "2017-08-07T00:00:00Z",
    "requestConfig": {
        "path": "/path",
        "method": "GET"
    },
    "requestParameters": [{
        "name": "age",
        "in": "HEADER",
        "type": "Int",
        "defaultValue": 18,
        "required": "REQUIRED",
        "desc": "age "
    }],
    "serviceType": "SCF",
    "serviceTimeout": 60,
    "serviceScfFunctionName": "myScfFunction"
}