Updated on 2025-07-04 GMT+08:00

Updating a Playbook Rule

Function

This API is used to update a playbook rule.

Calling Method

For details, see Calling APIs.

URI

PUT /v1/{project_id}/workspaces/{workspace_id}/soc/playbooks/versions/{version_id}/rules/{rule_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

workspace_id

Yes

String

Workspace ID.

version_id

Yes

String

Playbook version ID.

rule_id

Yes

String

Playbook rule ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

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.

content-type

Yes

String

application/json;charset=UTF-8

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

rule

No

ConditionInfo object

Details about playbook triggering rules.

Table 4 ConditionInfo

Parameter

Mandatory

Type

Description

expression_type

No

String

Expression type. The default value is common. This parameter is mandatory for event-triggered playbooks.

conditions

No

Array of ConditionItem objects

Trigger condition. This parameter is mandatory for event-triggered playbooks.

logics

No

Array of strings

Condition logic combination. This parameter is mandatory for event-triggered playbooks.

cron

No

String

Cron expression (scheduled task). This parameter is mandatory for timer-triggered playbooks.

schedule_type

No

String

Scheduled repetition type (second; hour; day; week). This parameter is mandatory for timer-triggered playbooks.

start_type

No

String

Playbook execution start type. IMMEDIATELY: The playbook is executed immediately after being created. CUSTOM: The playbook is executed at the time you specify for it. This parameter is mandatory for timer-triggered playbooks.

end_type

No

String

Playbook execution end type. FOREVER: The playbook will be executed permanently. CUSTOM: The playbook will end at the time you specify for it. This parameter is mandatory for timer-triggered playbooks.

end_time

No

String

End time of a scheduled task. This parameter is mandatory for timer-triggered playbooks.

repeat_range

No

String

Execution time: 2021-01-30T23:00:00Z+0800. This parameter is mandatory for timer-triggered playbooks.

only_once

No

Boolean

Whether to execute it only once. This parameter is mandatory for timer-triggered playbooks.

execution_type

No

String

Execution queue type. PARALLEL: The new task is executed concurrently with the previous task. This parameter is mandatory for timer-triggered playbooks.

Table 5 ConditionItem

Parameter

Mandatory

Type

Description

name

No

String

Condition name.

detail

No

String

Condition details.

data

No

Array of strings

Condition expression data.

Response Parameters

Status code: 200

Table 6 Response header parameters

Parameter

Type

Description

X-request-id

String

Request ID. Format: request_uuid-timestamp-hostname.

Table 7 Response body parameters

Parameter

Type

Description

code

String

Error code.

message

String

Error message.

data

RuleInfo object

Playbook trigger information.

Table 8 RuleInfo

Parameter

Type

Description

id

String

Rule ID.

project_id

String

Project ID.

rule

String

Trigger rules.

Status code: 400

Table 9 Response header parameters

Parameter

Type

Description

X-request-id

String

Request ID. Format: request_uuid-timestamp-hostname.

Table 10 Response body parameters

Parameter

Type

Description

code

String

Error code.

message

String

Error description.

Example Requests

Update a playbook rule named condition_0 and set the expression type to all.

{
  "rule" : {
    "expression_type" : "common",
    "conditions" : [ {
      "name" : "condition_0",
      "detail" : "123",
      "data" : [ "handle_status, ==, Open" ]
    } ],
    "logics" : [ "condition_0" ]
  }
}

Example Responses

Status code: 200

Response parameters for a successful request.

{
  "code" : 0,
  "message" : "Error message",
  "data" : {
    "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f",
    "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f",
    "rule" : "909494e3-558e-46b6-a9eb-07a8e18ca62f"
  }
}

Status Codes

Status Code

Description

200

Response parameters for a successful request.

400

Response parameters for failed requests.

Error Codes

See Error Codes.