Creating a Custom Job
Function
This API is used to create a custom job.
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
coc:document:createDocument
Write
document *
-
-
-
URI
POST /v1/documents
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Definition: Job name. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
content |
Yes |
String |
Definition: Job content, which is a DSL statement. The maximum length is 64 KB. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
enterprise_project_id |
Yes |
String |
Definition: Enterprise project ID. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
risk_level |
Yes |
String |
Definition: Risk level. Constraints: N/A. Value range: Default value: N/A. |
|
description |
No |
String |
Definition: Job description. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
tags |
No |
Array of tags objects |
Definition: Tag list. Constraints: N/A. Value range: N/A. Default value: N/A. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
data |
String |
Definition: Job ID returned by the system when a job is created. Value range: N/A. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition: Error code. Value range: For details, see Error Codes. |
|
error_msg |
String |
Definition: Error description. Value range: For details, see Error Codes. |
Example Requests
Create a custom job.
POST https://{Endpoint}/v1/documents
{
"name" : "test_document",
"description" : "",
"enterprise_project_id" : "0",
"risk_level" : "LOW",
"content" : "meta:\n name: test_document\n schemaVersion: 3\n description: \"\"\ninputs: {}\nsteps:\n - name: pause\n description: pause\n task: hwc:runbook:suspend@1.0.0\n inputs: {}\n outputs: []"
}
Example Responses
Status code: 200
Request succeeded.
{
"data" : "DM20250701180239xxxxx"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Request succeeded. |
|
400 |
The contained error information is returned. For more status codes, see Status Codes. |
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