Create Service

Last updated: 2019-07-24 16:16:53

API Description

This API (CreateService) is used to create a service.
The largest unit used by an API gateway is a service, in which many APIs can be created. Each service has a default domain name for users to call. Users can also bind a custom domain name to the service.

Input Parameters

The following request parameter list only provides API request parameters. Other parameters can be found in Common Request Parameters.

Parameter Name Required Type Description
serviceName No String User-defined service name. The system automatically generates a unique name if nothing is passed.
serviceDesc No String User-defined service description.
protocol Yes String Frontend request type of the service, such as HTTP, HTTPS, HTTP and HTTPS.

Output Parameters

Parameter Name Type Description
code Int Common error code. 0: Successful; other values: Failed. For more information, see Common Error Codes on the Error Codes page.
codeDesc String Error code at business side. For a successful operation, "Success" is returned. In case of an error, a message describing the reason for the error is returned.
message String Module error message description depending on API.
serviceName String Service name.
serviceDesc String Service description.
subDomain String The domain name of the service generated automatically by the system.
serviceId String The globally unique ID of the service generated by the system.
createdTime Timestamp Creation time. It is in the format of YYYY-MM-DDThh:mm:ssZ according to the ISO8601 standard. UTC time is used.

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",
}