You can call this operation to publish a layer version.

Request headers

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

Request syntax

POST /layers/{layerName}/versions/ HTTP/1.1

Request parameters

Parameter Type Position Required Example Description
layerName String Path Yes Layer-name

The name of the layer.

Object Body No

The description of the layer.

code Code Body No

The code of the function. The code must be packaged into a ZIP file.

description String Body No Layer-description

The description of the layer.

compatibleRuntime Array of String Body No nodejs12

The runtime environment supported by the layer. Valid values: nodejs12, nodejs10, nodejs8, nodejs6, python3, and python2.7.

Response parameters

Parameter Type Example Description
ETag String e19d5cd5af0378da05f63f891c7467af

This value is used to ensure that the modified layer is consistent with the layer to be modified.

Layer

The layer structure returned.

Examples

Sample requests

POST /2016-08-15/layers/Layer-name/versions HTTP/1.1
Common request parameters

{
  "code" : {
    "ossBucketName" : "test-bucket",
    "ossObjectName" : "test-object",
    "zipFile" : "samplecode"
  },
  "description" : "Layer-description",
  "compatibleRuntime" : [ "nodejs12" ]
}

Sample success responses

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "layerName" : "Layer-name",
  "version" : 1,
  "description" : "Layer-description",
  "code" : {
    "repositoryType" : "OSS",
    "location" : "https://xyz.oss-cnxxx.aliyuncs.com/xxx/xxx/xxx"
  },
  "codeSize" : 421,
  "codeChecksum" : "2825179536350****",
  "createTime" : "2020-11-11T11:08:00Z",
  "acl" : 0,
  "compatibleRuntime" : [ "python3" ],
  "arn" : "02f81d283888f5ec63442a88fe82b260#Layer-name#1"
}