Push Data API
Last Updated:2025-11-14
API description
Push data to BCM for monitoring. With the Custom Monitor function, data can be pushed to BCM for real-time monitoring using this API.
Usage restrictions
Currently, the Custom Monitor function is available only in the Beijing, Guangzhou, Suzhou, and Hong Kong regions and unavailable elsewhere.
Request structure
- Method: POST
- URL:/json-api/v1/metricdata/{userid}/{scope}
- For the request body, refer to the request parameters and examples below
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | Tenant ID | Yes | URL parameter |
| scope | String, limited to the following character set: 0~9, A~Z, a~z, _ | Scope | Yes | URL parameter |
| metricData | List<MetricDatum> | Monitor item data | Yes | RequestBody |
MetricDatum
| Name | Types | Description | Required or not |
|---|---|---|---|
| metricName | String | Monitor item name | Yes |
| dimensions | List<Dimension> | Dimension | Yes |
| value | double | Monitor item value | No |
| timestamp | String | Time | Yes |
Dimension
| Name | Types | Description | Required or not |
|---|---|---|---|
| name | String | Dimension name | Yes |
| value | String | Dimension value | Yes |
Response parameters
| Name | Types | Description |
|---|---|---|
| requestId | String | Request identifier |
| code | String | Return code |
| message | String | Return information |
Request example
POST /json-api/v1/metricdata/user1/UserDefined_BCC HTTP/1.1
Host:bcm.bj.baidubce.com:80
{
"metricData": [
{
"metricName": "pv",
"dimensions": [
{
"name": "os",
"value": "centos"
},
{
"name": "serviceName",
"value": "myService"
}
],
"value": 1234567,
"timestamp": "2014-05-26T07:30:00Z"
},
{
"metricName": "responseTime",
"dimensions": [
{
"name": "os",
"value": "windows"
},
{
"name": "serviceName",
"value": "myService"
}
],
"value": 1234568,
"timestamp": "2014-05-26T07:30:00Z"
}
]
}Response example
Successful response example
{
"requestId": "45113fb2-fe84-411f-809b-9383d43003cd",
"code": "OK",
"message": ""
}Unsuccessful response example
{
"requestId": "45113fb2-fe84-411f-809b-9383d43003cd",
"code": "INVALID_PARAMETER_VALUE",
"message": "Metric data required"
}