Querying Scripts
Function
This API is used to query the custom scripts.
Constraints
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:list
List
document *
-
-
-
 
URI
GET /v1/job/scripts
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        limit  | 
      
        Yes  | 
      
        Integer  | 
      
        Definition: Pagination parameter, which indicates the maximum number of records returned on each page. Constraints: The maximum value is 100. Value range: N/A. Default value: N/A.  | 
     
| 
        marker  | 
      
        No  | 
      
        Long  | 
      
        Definition: Pagination parameter, which indicates ID of the last record on the previous page. Constraints: N/A. Value range: N/A. Default value: N/A.  | 
     
| 
        name_like  | 
      
        No  | 
      
        String  | 
      
        Definition: Script name queried by fuzzy search. Constraints: N/A. Value range: N/A. Default value: N/A.  | 
     
| 
        creator  | 
      
        No  | 
      
        String  | 
      
        Definition: Creator. Constraints: N/A. Value range: N/A. Default value: N/A.  | 
     
| 
        risk_level  | 
      
        No  | 
      
        String  | 
      
        Definition: Risk level. Constraints: Value range: LOW, MEDIUM, or HIGH. Default value: N/A.  | 
     
| 
        type  | 
      
        No  | 
      
        String  | 
      
        Definition: Script type. Constraints: The value can be SHELL, PYTHON, and BAT. Value range: SHELL, PYTHON, or BAT. Default value: N/A.  | 
     
| 
        enterprise_project_id  | 
      
        No  | 
      
        String  | 
      
        Definition: Enterprise project ID. Constraints: N/A. Value range: N/A. Default value: N/A.  | 
     
Request Parameters
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        X-Auth-Token  | 
      
        Yes  | 
      
        String  | 
      
        Definition: Tenant token. Constraints: Tenant token obtained from IAM. Value range: N/A. Default value: N/A.  | 
     
| 
        X-Language  | 
      
        No  | 
      
        String  | 
      
        Definition: Internationalization tag. zh-cn indicates Chinese, and en-us or no value indicates English. Constraints: zh-cn indicates Chinese, and en-us or no value indicates English. Value range: zh-cn and en-us Default value: N/A.  | 
     
| 
        x-project-id  | 
      
        No  | 
      
        String  | 
      
        Definition: The project ID. Constraints: Project ID corresponding to the region. Value range: N/A. Default value: N/A.  | 
     
| 
        x-user-profile  | 
      
        No  | 
      
        String  | 
      
        Definition: IAM 5.0 user information. Constraints: N/A. Value range: N/A. Default value: N/A.  | 
     
Response Parameters
Status code: 200
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        data  | 
      
        ScriptListPage object  | 
      
        Definition: Response body of the script list. Value range: N/A.  | 
     
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        total  | 
      
        Long  | 
      
        Definition: Total number of records. Value range: N/A.  | 
     
| 
        data  | 
      
        Array of ScriptListModel objects  | 
      
        Definition: Data listed on a single page. Value range: N/A.  | 
     
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        id  | 
      
        Long  | 
      
        Definition: Auto-added script ID. Value range: N/A.  | 
     
| 
        script_uuid  | 
      
        String  | 
      
        Definition: Script UUID. Value range: N/A.  | 
     
| 
        enterprise_project_id  | 
      
        String  | 
      
        Definition: Enterprise project ID. The preset value is 0. Value range: N/A.  | 
     
| 
        name  | 
      
        String  | 
      
        Definition: Script name. Value range: N/A.  | 
     
| 
        type  | 
      
        String  | 
      
        Definition: Script type. The value can be SHELL, PYTHON, and BAT. Value range: SHELL, PYTHON, or BAT.  | 
     
| 
        status  | 
      
        String  | 
      
        Definition: Script status. The value can be PENDING_APPROVE, APPROVED, and REJECTED. Value range: PENDING_APPROVE, APPROVED, or REJECTED.  | 
     
| 
        gmt_created  | 
      
        Long  | 
      
        Definition: Creation time. Value range: N/A.  | 
     
| 
        gmt_modified  | 
      
        Long  | 
      
        Definition: Modification time. Value range: N/A.  | 
     
| 
        creator  | 
      
        String  | 
      
        Definition: Creator. Value range: N/A.  | 
     
| 
        creator_id  | 
      
        String  | 
      
        Definition: Creator ID. Value range: N/A.  | 
     
| 
        operator  | 
      
        String  | 
      
        Definition: Modifier. Value range: N/A.  | 
     
| 
        properties  | 
      
        ScriptPropertiesModel object  | 
      
        Definition: Script label. Risk level (value range: LOW, MEDIUM, and HIGH) and reviewer are included. Value range: N/A.  | 
     
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        risk_level  | 
      
        String  | 
      
        Definition: Risk level. Constraints: Value range: LOW, MEDIUM, or HIGH. Default value: N/A.  | 
     
| 
        version  | 
      
        String  | 
      
        Definition: Script version. Constraints: Format: 1.0.0 Value range: N/A. Default value: N/A.  | 
     
| 
        reviewers  | 
      
        Array of ReviewerInfo objects  | 
      
        Definition: Reviewer. If this parameter is not specified, review is not required. Constraints: N/A. Value range: N/A. Default value: N/A.  | 
     
| 
        protocol  | 
      
        String  | 
      
        Definition: Review message notification protocol, which is used to notify the reviewer. Constraints: EMAIL, DING_TALK, WE_LINK, WECHAT, CALLNOTIFY, and NOT_TO_NOTIFY. Value range: DEFAULT, SMS, EMAIL, DING_TALK, WE_LINK, WECHAT, CALLNOTIFY, or NOT_TO_NOTIFY. Default value: N/A.  | 
     
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        reviewer_name  | 
      
        String  | 
      
        Definition: Reviewer name (IAM username). Constraints: IAM username. Value range: N/A. Default value: N/A.  | 
     
| 
        reviewer_id  | 
      
        String  | 
      
        Definition: Reviewer ID (IAM user ID). Constraints: IAM user ID. Value range: N/A. Default value: N/A.  | 
     
Status code: 400
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        error_code  | 
      
        String  | 
      
        Definition: Error code. Value range: See the error code section.  | 
     
| 
        error_msg  | 
      
        String  | 
      
        Definition: Error description. Value range: See the error code section.  | 
     
Example Requests
Query the custom scripts.
GET https://{Endpoint}/v1/job/scripts?limit=100
 Example Responses
Status code: 200
Script pagination data is returned.
For more status codes, see "Status Codes" in coc_api_05_03.xml.
{
  "data" : {
    "total" : 70,
    "data" : [ {
      "id" : 6229,
      "name" : "Test 111",
      "type" : "SHELL",
      "creator" : "runbook_notif",
      "creator_id" : "e56462d17f334b8789ff0b5b9cca3bb9",
      "operator" : null,
      "gmt_created" : 1701314214271,
      "gmt_modified" : null,
      "status" : "APPROVED",
      "script_uuid" : "SC20231130111654023511657",
      "usage_count" : 0,
      "properties" : {
        "risk_level" : "HIGH",
        "reviewers" : [ ],
        "version" : "1.0.0",
        "protocol" : null
      },
      "enterprise_project_id" : 0
    }, {
      "id" : 6228,
      "name" : "Test 11",
      "type" : "SHELL",
      "creator" : "runbook_notif",
      "creator_id" : "e56462d17f334b8789ff0b5b9cca3bb9",
      "operator" : null,
      "gmt_created" : 1701314090063,
      "gmt_modified" : null,
      "status" : "APPROVED",
      "script_uuid" : "SC20231130111450026f7f8b2",
      "usage_count" : 0,
      "properties" : {
        "risk_level" : "LOW",
        "reviewers" : [ ],
        "version" : "1.0.0",
        "protocol" : null
      },
      "enterprise_project_id" : 0
    } ]
  }
}
  Status code: 400
The contained error information is returned.
For more status codes, see Status Codes.
{
  "error_code" : "COC.00040701",
  "error_msg" : "error_msg"
}
 Status Codes
| 
        Status Code  | 
      
        Description  | 
     
|---|---|
| 
        200  | 
      
        Script pagination data is returned. For more status codes, see Status Codes.  | 
     
| 
        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