Updated on 2026-06-11 GMT+08:00

Updating Graphs in Batches

Function

This API is used to update graphs in batches.

Constraints

This API is not supported in the following regions: CN East-Qingdao, LA-Mexico City1, TR-Istanbul, AP-Jakarta, ME-Riyadh, and AP-Manila.

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

    ces:widgets:put

    Write

    -

    ces:namespace

    -

    -

URI

POST /v2/{project_id}/widgets/batch-update

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. It is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID.

Constraints

N/A

Range

1 to 64 characters.

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

No

String

Definition

MIME type of the request body.

Constraints:

None

Value range:

The value can contain 1 to 64 characters.

Default value:

The default type is application/json; charset=UTF-8.

X-Auth-Token

No

String

Definition

User token.

Constraints:

None

Value range:

The value can contain 1 to 16,384 characters.

Default value:

None

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

[items]

Yes

Array of UpdateWidgetInfo objects

Definition

List of graphs to be modified.

Constraints

The list can contain 1 to 50 graphs.

Table 4 UpdateWidgetInfo

Parameter

Mandatory

Type

Description

group_id

No

String

Definition

Graph partition ID.

Constraints

N/A

Range

The value must start with dg and is followed by 22 characters of letters, digits, or a combination of both. The total length is 24 characters. The value can also be default (no grouping).

Default Value

N/A

widget_id

Yes

String

Definition

Graph ID.

Constraints

N/A

Range

The value must start with wg and is followed by 22 characters of letters, digits, or a combination of both. The total length is 24 characters.

Default Value

N/A

metrics

No

Array of WidgetMetric objects

Definition

Metric list.

Constraints

[1,200]

title

No

String

Definition

Graph name.

Constraints

N/A

Range

The value allows 1 to 128 characters. It can contain only letters, digits, and these characters: _-:;().~

Default Value

N/A

threshold

No

Double

Definition

Threshold of metrics on the graph.

Constraints

N/A

Range

[0,1.7976931348623157e+308]

Default Value

N/A

threshold_enabled

No

Boolean

Definition

Whether to display the threshold.

Constraints

N/A

Range

  • true: displayed.

  • false: not displayed.

Default Value

N/A

view

No

String

Definition

Graph type.

Constraints

N/A

Range

The value can be:

  • bar: horizontal bar chart.

  • line: line chart.

  • bar_chart: bar chart.

  • table: table.

  • circular_bar: radial bar chart.

  • area_chart: area chart.

  • gauge: gauge chart.

  • stat: number.

Default Value

N/A

metric_display_mode

No

String

Definition

Metric display type.

Constraints

N/A

Range

The value can be:

  • single: single-metric.

  • multiple: multi-metric.

Default Value

N/A

properties

No

properties object

Definition

Graph display configuration.

Constraints

N/A

location

No

location object

Definition

Graph coordinates.

Constraints

N/A

unit

No

String

Definition

Unit.

Constraints

N/A

Range

[0,32]

Default Value

N/A

Table 5 WidgetMetric

Parameter

Mandatory

Type

Description

namespace

Yes

String

Definition

Namespace of the service. For details, see Services Interconnected with Cloud Eye.

Constraints

N/A

Range

The value is in the service.item format. The values of service and item must start with a letter and contain only letters, digits, and underscores (_). It can contain 3 to 32 characters.

Default Value

N/A

dimensions

Yes

DimensionInfo object

Definition

Dimension list.

Constraints

N/A

metric_name

Yes

String

Definition

Multiple metric names.

Constraints

N/A

Range

The value can contain 1 to 1,080 characters. Multiple metric names are separated by commas (,).

Default Value

N/A

alias

No

Array of strings

Definition

Metric aliases of the graph.

Constraints

This parameter can be transferred only when the resource type is set to specified resources.

You can specify up to 200 metric aliases.

extra_info

No

ExtraInfo object

Definition

Metric information.

Constraints

N/A

y_axis_position

No

String

Definition

Y axis the threshold line aligns with.

Constraints

N/A

Range

The value can be:

  • left: left Y axis.

  • right: right Y axis.

Default Value

N/A

rollup_enable

No

Boolean

Definition

Whether to enable aggregation.

Constraints

If rollup_enable is enabled, rollup_filter and rollup_dimension are mandatory.

Range

  • true: enabled

  • false: disabled

Default Value

false

rollup_filter

No

String

Definition

Aggregation rule.

Constraints

If rollup_enable is enabled, rollup_filter and rollup_dimension are mandatory.

Range

  • last: latest value

  • max: maximum value

  • min: minimum value

  • average

  • sum

Default Value

N/A

rollup_dimension

No

String

Definition

Aggregation dimension.

Constraints

N/A

Range

1 to 32 characters

Default Value

N/A

last_week_compare_enable

No

Boolean

Definition

Whether to display comparison data (same period last week).

Constraints

N/A

Range

  • true: display

  • false: not display

Default Value

N/A

yesterday_compare_enable

No

Boolean

Definition

Whether to display comparison data (same period yesterday).

Constraints

N/A

Range

  • true: display

  • false: not display

Default Value

N/A

metric_dimension

No

String

Definition

Metric names, separated by commas (,). For details about the dimension names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye. Each dimension name must start with a letter. It allows 1 to 32 characters and can contain only letters, digits, underscores (_), and hyphens (-). Multiple dimensions are separated by commas (,). The value can contain 1 to 131 characters. A maximum of four dimensions are supported. Example: instance_id for single-dimension scenarios and instance_id,disk for multi-dimension scenarios.

Constraints

N/A

Range

1 to 131 characters.

Default Value

N/A

top_num

No

Integer

Definition

Number of displayed data records.

Constraints

N/A

Range

1 to 200

Default Value

N/A

unit

No

String

Definition

Unit.

Constraints

N/A

Range

[0,32]

Default Value

N/A

order

No

String

Definition

Sorting field.

Constraints

N/A

Range

  • asc: ascending

  • desc: descending

Default Value

N/A

topn_metric_name

No

String

Definition

Metric name of a resource. The name must start with a letter and contain only letters, digits, and underscores (_). The length ranges from 1 to 64 characters. For example, cpu_util of an ECS indicates the CPU usage of the ECS. mongo001_command_ps in DDS indicates the command execution frequency. For details about the metric names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye.

Constraints

N/A

Range

1 to 96 characters.

Default Value

N/A

Table 6 DimensionInfo

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Dimension name.

Constraints

N/A

Range

Multiple dimensions are separated by commas (,). For details about the dimension names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye. The value must start with a letter. Each dimension allows 1 to 32 characters and can only contain letters, digits, underscores (_), and hyphens (-). Multiple dimensions are separated by commas (,). The value can contain 1 to 131 characters. A maximum of four dimensions are supported. Example: instance_id for single-dimension scenarios and instance_id,disk for multi-dimension scenarios.

Default Value

N/A

filter_type

Yes

String

Definition

Resource type.

Constraints

  1. When you set view to bar_chart, bar, circular_bar, or table, filter_type cannot be set to specific_instances.

  2. When rollup_enable is left blank, filter_type cannot be set to resource_groups.

Range

  • all_instances: all resources.

  • specific_instances: specified resources.

  • resource_groups: resource groups.

Default Value

N/A

values

No

Array of strings

Definition

Dimension value list.

Constraints

You can specify up to 200 dimension values.

Table 7 ExtraInfo

Parameter

Mandatory

Type

Description

origin_metric_name

Yes

String

Definition

Metric name.

Constraints

N/A

Range

1 to 4,096 characters

Default Value

N/A

metric_prefix

No

String

Definition

Metric name prefix.

Constraints

N/A

Range

1 to 4,096 characters

Default Value

N/A

metric_type

No

String

Definition

Metric type.

Constraints

N/A

Range

1 to 32 characters

Default Value

N/A

custom_proc_name

No

String

Definition

Custom process name.

Constraints

N/A

Range

1 to 250 characters

Default Value

N/A

Table 8 properties

Parameter

Mandatory

Type

Description

filter

No

String

Definition

Aggregation type.

Constraints

This parameter is not available for line charts.

Range

The value can be:

  • topN: top N.

Default Value

N/A

topN

No

Integer

Definition

Top n resources sorted by a metric.

Constraints

In a line chart, this parameter indicates the number of time series data records that are randomly displayed.

Range

[1,2147483647]

Default Value

N/A

order

No

String

Definition

Sorting field.

Constraints

This parameter is not available for line charts.

Range

The value can be:

  • asc: ascending.

  • desc: descending.

Default Value

N/A

description

No

String

Definition

Graph description.

Constraints

N/A

Range

0 to 200 characters.

Default Value

N/A

last_week_compare_enable

No

Boolean

Definition

Whether to display comparison data (same period last week).

Constraints

N/A

Range

  • true: displayed.

  • false: not displayed.

Default Value

N/A

yesterday_compare_enable

No

Boolean

Definition

Whether to display comparison data (same period yesterday).

Constraints

N/A

Range

  • true: displayed.

  • false: not displayed.

Default Value

N/A

legend_location

No

String

Definition

Legend location.

Constraints

This parameter is not available for tables.

Range

The value can be:

  • hide: hides the legend.

  • right: right of the graph.

  • bottom: bottom of the graph.

Default Value

N/A

legend_values

No

Array of strings

Definition

List of statistical values to be displayed in the legend for the current time series.

Constraints

This parameter is not available for tables. For horizontal bar charts and vertical bar charts, only last can be configured for this parameter.

You can specify up to five values.

thresholds

No

Array of ThresholdInfo objects

Definition

Threshold line configured for the graph.

Constraints

You can configure up to six objects.

is_all_compare_enable

No

Boolean

Definition

Whether to enable PoP comparison.

Constraints

N/A

Range

  • true: enabled.

  • false: disabled.

Default Value

N/A

Table 9 ThresholdInfo

Parameter

Mandatory

Type

Description

threshold

Yes

Number

Definition

Threshold of the threshold line configured for the graph.

Constraints

N/A

Range

The value ranges from 0 to 2147483647.

Default Value

N/A

threshold_color

Yes

String

Definition

Color of the threshold line for the graph.

Constraints

N/A

Range

  • "#B50E65": purple

  • "#F23030": red

  • "#FF8800": orange

  • "#F2E70C": yellow

Default Value

N/A

Table 10 location

Parameter

Mandatory

Type

Description

top

Yes

Integer

Definition

Grids between the graph and the top of the dashboard.

Constraints

N/A

Range

[0,2147483647]

Default Value

N/A

left

Yes

Integer

Definition

Grids between the graph and the left side of the dashboard.

Constraints

N/A

Range

[0,9]

Default Value

N/A

width

Yes

Integer

Definition

Graph width.

Constraints

N/A

Range

[3,12]

Default Value

N/A

height

Yes

Integer

Definition

Graph height.

Constraints

N/A

Range

[3,2147483647]

Default Value

N/A

Response Parameters

Status code: 200

Table 11 Response body parameters

Parameter

Type

Description

widgets

Array of BatchUpdateWidgetInfo objects

Definition

Update result list.

Table 12 BatchUpdateWidgetInfo

Parameter

Type

Description

widget_id

String

Definition

Graph ID.

Range

The value must start with wg and is followed by 22 characters of letters, digits, or a combination of both. The total length is 24 characters.

ret_status

String

Definition

Modification result.

Range

The value can be:

  • successful: succeeded.

  • error: failed.

error_msg

String

Definition

Error message when an operation fails.

Range

1 to 2,048 characters.

Status code: 400

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Status codes customized by each cloud service when a request error occurs.

error_msg

String

Request error message.

request_id

String

Request ID.

Status code: 401

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Status codes customized by each cloud service when a request error occurs.

error_msg

String

Request error message.

request_id

String

Request ID.

Status code: 500

Table 15 Response body parameters

Parameter

Type

Description

error_code

String

Status codes customized by each cloud service when a request error occurs.

error_msg

String

Request error message.

request_id

String

Request ID.

Example Requests

[ {
  "widget_id" : "wgXXXXXXXXXXXXXXXXXXXXXX",
  "metrics" : [ {
    "namespace" : "SYS.ECS",
    "dimensions" : {
      "name" : "instance_id",
      "filter_type" : "all_instances"
    },
    "metric_name" : "cpu_util",
    "alias" : [ "cpuutilalias" ],
    "extra_info" : {
      "origin_metric_name" : "cpu_util",
      "metric_prefix" : "cpu",
      "metric_type" : "type",
      "custom_proc_name" : "app.sh"
    }
  } ],
  "view" : "bar",
  "metric_display_mode" : "single",
  "threshold" : 500,
  "threshold_enabled" : false,
  "title" : "widget_title_new",
  "properties" : {
    "filter" : "topN",
    "topN" : 10,
    "order" : "asc"
  },
  "location" : {
    "left" : 0,
    "top" : 3,
    "width" : 4,
    "height" : 3
  },
  "unit" : "%"
} ]

Example Responses

Status code: 200

OK

{
  "widgets" : [ {
    "widget_id" : "wgXXXXXXXXXXXXXXXXXXXXXX",
    "ret_status" : "successful"
  }, {
    "widget_id" : "wg9876543210123456789012",
    "ret_status" : "error",
    "error_msg" : "record not found"
  } ]
}

Status Codes

Status Code

Description

200

OK

400

The server failed to process the request.

401

Token authentication is required.

500

Failed to complete the request because of an internal server error.

Error Codes

See Error Codes.