Push Data Interface
Last Updated:2020-07-20
Interface Description
Push the data to BCM for monitoring. When using the custom monitoring feature, you can push the data to BCM via this interface for real-time monitoring.
Usage Restriction
Currently, only Beijing, Guangzhou, Suzhou and Hong Kong Regions can use the custom monitoring feature, and other Regions don't support the feature.
Request Structure
- Request method: POST
- URL: /json-api/v1/metricdata/{userid}/{scope}
- For the request body, please refer to the following request parameters and request examples.
Request Parameter
| Name | Type | Description | Required or not | Parameter position | 
|---|---|---|---|---|
| userId | String | Tenant ID | Yes | URL parameter | 
| scope | String, only limited to usage of the following character sets: "0~9, "A~Z", "a~z" and "_". | Name space | Yes | URL parameter | 
| metricData | List<MetricDatum> | Monitoring item data | Yes | RequestBody parameter | 
MetricDatum
| Name | Type | Description | Required or not | 
|---|---|---|---|
| metricName | String | Monitoring item name | Yes | 
| dimensions | List<Dimension> | Dimension | Yes | 
| value | double | Monitoring item value | No | 
| timestamp | String | Time | Yes | 
Dimension
| Name | Type | Description | Required or not | 
|---|---|---|---|
| name | String | Dimension name | Yes | 
| value | String | Dimension value | Yes | 
Response Parameter
| Name | Type | Description | 
|---|---|---|
| requestId | String | Request identification | 
| code | String | Return code | 
| message | String | Return message | 
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": "" 
} Failed response example
{ 
    "requestId": "45113fb2-fe84-411f-809b-9383d43003cd", 
    "code": "INVALID_PARAMETER_VALUE", 
    "message": "Metric data required" 
}