You can call this operation to create an alias.

Request headers

This operation uses only common request headers. For more information, see Common parameters.

Request syntax

POST /services/{serviceName}/aliases 

Request parameters

Parameter Type Position Required Example Description
serviceName String Path Yes service_name

The name of the service.

Object Body No

The definition of the alias.

additionalVersionWeight Map Body No

The additional version to which the alias points and the weight of the additional version.

  • The additional version takes effect only when the function is invoked.
  • The value consists of a version number and the corresponding weight. For example, 2:0.05 indicates that when a function is invoked, version 2 is the additional version, 5% of the traffic is distributed to the additional version, and 95% of the traffic is distributed to the major version.
Float Body No 1

The traffic weight. Valid values: 0 to 1.

aliasName String Body No alias_test

The name of the alias.

description String Body No test_description

The description of the alias.

versionId String Body No 1

The version to which the alias points.

Response parameters

Parameter Type Example Description
additionalVersionWeight Map

The additional version to which the alias points and the weight of the additional version.

  • The additional version takes effect only when the function is invoked.
  • The value consists of a version number and the corresponding weight. For example, 2:0.05 indicates that when a function is invoked, version 2 is the additional version, 5% of the traffic is distributed to the additional version, and 95% of the traffic is distributed to the major version.
Float 1

The traffic weight. Valid values: 0 to 1.

aliasName String alias_test

The name of the alias.

createdTime String 2020-04-23T06:32:43Z

The time when the alias was created.

description String test_description

The description of the alias.

lastModifiedTime String 2020-04-23T06:32:43Z

The last time when the alias was updated.

serviceName String service_name

The name of the service.

versionId String 1

The version to which the alias points.

Examples

Sample requests

POST /2016-08-15/services/service_name/aliases HTTP/1.1
Common request headers
{
    "aliasName":"alias_test",
    "versionId":"1",
    "description":"test_description"
}

Sample success responses

JSON format

HTTP/1.1 200 OK
Common response headers
{
  "aliasName": "alias_test",
  "versionId": "1",
  "description": "test_description",
  "additionalVersionWeight": null,
  "createdTime": "2020-04-23T06:32:43Z",
  "lastModifiedTime": "2020-04-23T06:32:43Z"
}