Creating a Lite Server Task
Function
This API is used to create a Lite Server task. It is used when you need to start a development, test, or deployment task on the Lite Server. Before using this API, ensure that you have the permission to create a task and the task configuration parameters meet the requirements. After the creation, the Lite Server task is created, and the task ID and other related information are returned. If you do not have the required permission, the parameters are incorrect, or the system resources are insufficient, the API returns an error message.
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:devserver:createJob
Write
-
-
-
-
URI
POST /v1/{project_id}/dev-servers/jobs
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition: Project ID. For details, see Obtaining a Project ID and Name. Constraints: N/A Range: 1 to 64 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Name. |
| description | No | String | Definition: Task description. Constraints: The value can contain at most 512 characters. Special characters (&<>"'/) are not allowed. Range: N/A Default Value: N/A |
| server_ids | Yes | Array of strings | The list of DevServer instance IDs. |
| type | Yes | String | Definition: Task template type. Constraints: ^[-_.a-zA-Z0-9]{1,64}$ Range: COMMON, SERVICE_DEPLOY, and others. Default Value: N/A. |
| is_reboot | No | Boolean | Definition: Specifies whether to restart the task after the task fails. Constraints: N/A. Range: true and false. Default Value: false. |
| items | Yes | Array of DevServerJobItem objects | Task instance list. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| create_at | Long | Definition: Creation time, which is a Unix timestamp in milliseconds. Range: N/A |
| update_at | Long | Definition: Update time, which is a Unix timestamp in milliseconds. Range: N/A |
| id | String | Definition: Task ID. Range: N/A |
| name | String | Definition: Task name. Range: N/A |
| type | String | Definition: Task template type. Range: COMMON, SERVICE_DEPLOY, and others. |
| status | String | Definition: Status. Range |
| items | Array of DevServerJobItem objects | Definition: Task instance list information. |
| tasks | Array of DevServerTaskResponse objects | Definition: Task details list. |
| template_id | String | Definition: Task template ID. Range: N/A |
| user_name | String | Definition: Information about the user who delivers the task. Range: N/A |
| abnormal_count | Integer | Definition: number of nodes where the task fails. Range: N/A |
| description | String | Definition: Description. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| type | String | Definition: Fine-grained task type. Range: COMMON, DEVICE_LOG_COLLECT, and others. |
| spec | Map<String,String> | Definition: Parameters required by the task. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition: Task ID. Range: N/A. |
| server_id | String | DevServer ID. |
| server_name | String | DevServer name. |
| status | String | Definition: Task status. Range: |
| cloud_server | Map<String,String> | Underlying ECS/BMS/HPS ID. |
| message | String | Output information. |
| create_at | Long | Creation time. |
| update_at | Long | Update time. |
Example Requests
POST https://{endpoint}/v1/{project_id}/dev-servers/jobs
{
"server_ids" : [ "66d210bc-023c-490a-8664-afd321a163ad" ],
"type" : "HDK_UPGRADE",
"items" : [ {
"spec" : {
"version" : "24.1.rc3.10"
},
"type" : "HDK_UPGRADE"
} ],
"name" : "hdk_upgrade_task",
"description" : "Task description."
} Example Responses
Status code: 200
{
"create_at" : 1755005748201,
"update_at" : 1755005931007,
"id" : "64e004ec-6cb0-401f-a7c0-ec2557626b16",
"name" : "hdk_upgrade_task",
"description" : "Task description.",
"type" : "ASCEND_SOFTWARE_UPGRADE",
"status" : "FINISHED",
"items" : [ {
"spec" : {
"version" : "24.1.rc3.10"
},
"type" : "HDK_UPGRADE"
} ],
"tasks" : [ {
"create_at" : 1755005748201,
"update_at" : 1755005931355,
"id" : "64e004ec-ad30-4038-9af1-afd321a163ad",
"server_id" : "66d210bc-023c-490a-8664-afd321a163ad",
"server_name" : "liteserver-978c-00001",
"cloud_server" : {
"hps_ecs_id" : "e2cb187a-4c4d-495c-a5f8-3de83a4e44ce",
"id" : "39aab8e4-add9-4c2a-8fb7-c3e477e23855",
"type" : "HPS"
},
"status" : "SUCCESS",
"message" : "the message"
} ],
"template_id" : "6f02d33b-a5d6-485c-8d73-480da5870512",
"user_name" : "modelarts_user",
"abnormal_count" : 0
} Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank 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