You can call this operation to query available instances of a function.
Usage notes
The ListInstances interface provides the ability to query the real-time status of a function instance. The instance queried by using this operation is the available instance on the traffic link of the corresponding function.
Available instances are instances that are executing requests or can be scheduled to process requests. The ListInstances is consistent with the instances in the InvokeFunction traffic link.
Request headers
This operation uses only common request headers. For more information, see Common parameters.
Request syntax
GET /services/{serviceName[.qualifier]}/functions/{function_name}/instances HTTP/1.1
Request parameters
Parameter | Type | Position | Required | Example | Description |
---|---|---|---|---|---|
serviceName | String | Path | Yes | service_name |
The name of the service. |
functionName | String | Path | Yes | function_name |
The name of the function |
qualifier | String | Path | No | test |
The version or alias of the service. The default value is LATEST. The qualifier here has the same meaning as the qualifier InvokeFunction, that is, the instance queried by the specified Notice The qualifier parameter to be passed in to query instances in reserved mode must be an alias, not
a version. Because reserved resources are directly bound to aliases, instances in
reserved mode are also managed under the corresponding aliases.
|
instanceIds | Array of String | Query | No | ["1ef6b6ff-7f7b-485e-ab49-501ac681****", "04db0821-c6d2-4c10-970b-93e36f1a****"] |
The ID of the instance. |
limit | Long | Query | No | 20 |
The number of resources to be returned. Valid values: [0,100]. The number of returned resources is smaller than or equal to the specified number. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Array |
The list of returned instance information. |
||
instanceId | String | ["1ef6b6ff-7f7b-485e-ab49-501ac681****", "04db0821-c6d2-4c10-970b-93e36f1a****"] |
The ID of the instance. |
versionId | Long | 1 |
The version of the service to which the instance belongs. If it is a function instance under a LATEST alias, the version number is 0. |
Examples
Sample requests
GET /services/{serviceName[.qualifier]}/functions/{function_name}/instances?instanceIds=["[\"1ef6b6ff-7f7b-485e-ab49-501ac681****\", \"04db0821-c6d2-4c10-970b-93e36f1a****\"]"]&limit=20 HTTP/1.1
Host:fc-ram.aliyuncs.com
Content-Type:application/json
Sample success responses
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
[ {
"instanceId" : "[\"1ef6b6ff-7f7b-485e-ab49-501ac681****\", \"04db0821-c6d2-4c10-970b-93e36f1a****\"]",
"versionId" : 1
} ]