Obtaining Service Deployments
Function
Supports pagination and filtering, which is applicable to the scenario where you need to view the deployment list based on specific conditions (such as the service status and name) on the management console or through APIs. Before calling this API, you must have the permission to obtain the deployment list and provide valid pagination parameters (such as the page number and number of records on each page) and filter criteria (such as the deployment status and name). After this API is called, the system returns the deployment list that meets the filter criteria, including the data of the specified page, total number of pages, and total number of records. If you do not have the permission to query the deployment list, or the provided pagination parameters and filter criteria are invalid, an error message is returned. If an internal error occurs during the query, the system returns an error message and records the error in the log.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
modelarts:service:listDeployments
Read
service *
-
-
-
URI
GET /v2/{project_id}/services/{service_id}/deployments
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details, see Obtaining a Project ID and Name. Constraints N/A Range Project ID. Default Value N/A |
| service_id | Yes | String | Definition: Service ID, which can be obtained from the response body during service creation or by querying the service list. The service_id field indicates the service ID. Constraints: N/A Range: Service ID. Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| sort_key | No | String | Definition Sorting field. Separate multiple fields with commas (,). The value can be create_at or update_at. The default value is update_at. Constraints N/A Range Default Value update_at |
| status | No | String | Definition If this parameter is set to all, this parameter is used together with delete_after to query deployments that have been deleted within the specified number of days. If this parameter is left empty or not set to all, deployments that have not been deleted are queried. Constraints N/A Range Default Value None |
| sort_dir | No | String | Definition Sorting mode. Constraints N/A Range Default Value DESC |
| limit | No | Integer | Definition Maximum number of records that can be returned. Constraints N/A Range [1,500] Default Value 10. |
| offset | No | Integer | Definition Offset of the pagination list query. Constraints N/A Range N/A Default Value 0. |
| delete_after | No | Integer | Definition This parameter is used together with status to query deployments that have been deleted within the specified number of days. It is valid only when status is set to all. Constraints N/A Range N/A Default Value 7 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. For details about how to obtain the token, see Obtaining a User Token Through Password Authentication. Constraints N/A Range N/A Default Value N/A |
| Content-Type | Yes | String | Definition Message body type or format. Constraints N/A Range Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| data | Array of data objects | Definition Real-time service data. |
| current | Integer | Definition Current page number, starting from 0. Range N/A |
| size | Integer | Definition Number of records on the current page. Range N/A |
| pages | Integer | Definition Total number of pages, which is calculated based on the limit field and the total number of data records. For example, if the total number of records is 10 and the value of limit (maximum number of records on a page) is 3, there are four pages. Range N/A |
| total | Integer | Definition Total number of records. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Service ID, which can be obtained from the response body during service creation or by obtaining services owned by the current user. The service_id field is the service ID. Range Service ID. |
| name | String | Definition Deployment name, which is customized when you create a service. Range The value can contain 1 to 128 characters, including letters, digits, hyphens (-), and underscores (_). |
| infer_name | String | Definition Deployment ID. Range N/A |
| service_group_name | String | Definition Service instance group ID. Range N/A |
| status | String | Definition Current service status. Only one status can be selected at a time. By default, filtering is disabled. Range |
| lts_state | String | Definition Status of the interconnection between the deployment and LTS. Range |
| mirror_traffic_enable | Boolean | Definition Specifies whether to enable image traffic. Range N/A |
| mirror_traffic_weight | String | Definition Image traffic weight. Range 50 |
| weight | Integer | Definition Weight percentage of the traffic allocated to the model. This parameter is mandatory only when the model is deployed as a real-time service. Range [0,100] |
| traffic_ratio | String | Definition Traffic ratio, that is, the ratio of the expected user traffic to the total traffic of a single deployment instance. The value is calculated based on the traffic weight configuration and deployment status. Range 0.00/ %to 100.00% |
| pool_id | String | Definition Dedicated resource pool ID. Range 50 |
| version | String | Definition Service version, which consists of digits and periods (.), for example, 1.0.1. Range The version length cannot exceed 8 characters. |
| deploy_type | String | Definition Deployment type. Range |
| create_at | Long | Definition Creation time, which is automatically generated. Range Millisecond-level timestamp, which is a 13-digit number. |
| update_at | Long | Definition Update time, which is automatically generated. Range Millisecond-level timestamp, which is a 13-digit number. |
| frozen_infos | Array of FrozenInfo objects | Definition Freezing type returned when a service or deployment is frozen. |
Example Requests
Obtain the service deployment list. When status is set to all, you can query deployments that have been deleted within the specified number of days.
GET https://{endpoint}/v2/{project_id}/services/{service_id}/deployments?limit=50&offset=0&status=all Example Responses
Status code: 200
Service list information.
{
"current" : 0,
"data" : [ {
"id" : "841e8dc2-2640-4916-ad21-a18b147b9149",
"name" : "service-ad4f",
"status" : "STOPPED",
"version" : "0.0.0",
"deploy_type" : "SINGLE",
"create_at" : 1747990876171,
"update_at" : 1747994527244
} ],
"pages" : 1,
"size" : 1,
"total" : 1
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Service list information. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot