Updated on 2025-06-19 GMT+08:00

Enabling or Disabling an Agent

Function

This API is used to enable or disable the agent audit function. An enabled agent collects user access information.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/{instance_id}/audit/agent/switch

Table 1 URI parameter

Parameter

Mandatory

Parameter Type

Description

project_id

Yes

String

Project ID.

instance_id

Yes

String

Instance ID. You can obtain the value from the ID field in the API for querying the instance list.

Request Parameter

Table 2 Request header parameter

Parameter

Mandatory

Parameter Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Table 3 Request body parameter

Parameter

Mandatory

Parameter Type

Description

agent_id

Yes

String

Audit agent ID. You can obtain the value from the ID field of the API for querying the agent list.

status

Yes

Integer

Agent status. The value can be:

  • 1: enabled.
  • 0: disabled.

Response Parameters

Status code: 200

Table 4 Response body parameter

Parameter

Parameter Type

Description

result

String

Response status.

Status code: 400

Table 5 Response body parameters

Parameter

Parameter Type

Description

error

Object

Error message.

Table 6 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 403

Table 7 Response body parameters

Parameter

Parameter Type

Description

error

Object

Error message.

Table 8 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Request

/v1/{project_id}/{instance_id}/audit/agent/switch

{
  "agent_id" : "ASWDSDSDSWEWDSDSD",
  "status" : 1
}

Response Examples

Status code: 200

The request has succeeded.

{
  "result" : "SUCCESS"
}

Status code: 400

Invalid request parameters.

{
  "error" : {
    "error_code" : "DBSS.XXX",
    "error_msg" : "XXX"
  }
}

Status code: 403

Authentication failed.

{
  "error" : {
    "error_code" : "DBSS.XXX",
    "error_msg" : "XXX"
  }
}

Status Code

Status Code

Description

200

The request is processed.

400

Invalid request parameters.

403

Authentication failed.

Error Codes

For details, see Error Codes.