Create Service

Last updated: 2020-02-21 16:17:30

Interface description

This API (CreateService) is used to create services.
The largest unit used by the API gateway is the service, and multiple API can be created in each service. Each service has a default domain name for customers to call, and users can also bind custom domain names to this service.

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
ServiceName No String User-defined service name. If not, the system automatically generates a unique name.
ServiceDesc No String User-defined service description.
Protocol Yes String The front-end request type of the service. Such as HTTP, HTTPS, HTTP and HTTPS.

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
ServiceName String Service Name
ServiceDesc String Service description
SubDomain String The domain name of the service, which is automatically generated by the system
ServiceId String Service unique Id, is generated by the system and globally unique
CreatedTime Timestamp Policy creation time. Expressed according to the ISO8601 standard, and using UTC time. Format: YYYY-MM-DDThh:mm:ssZ

Example

https://apigateway.api.qcloud.com/v2/index.php?
&<Common request parameters>
&Action=CreateService
&serviceName=test
&serviceDescription=testDescription
&protocol=http

The returned results are as below:

{
    "code": "0",
    "message": "",
    "codeDesc": "Success",
    "serviceId": "service-XXXX",
    "serviceName": "test",
    "serviceDesc": "desc",
    "subDomain": "523e8dc7bbe04613b5b1d726c2a7889d-apigateway.ap-guangzhou.qcloud.com",
    "createdTime": "2017-08-07T00:00:00Z"
}