Path:/openapi/v1/app/{app_id}/tag/{tag_name}/result/history
Method: POST
Content-type: application/json
Path-parameters : Just refer to the public parameters
Body:
{ "granularity":"day", "type":"past_range", "spans":[ { "type":"past", "past":{ "amount":7, "unit":"day" } }, { "type":"past", "past":{ "amount":1, "unit":"day" } } ], "timezone":"Asia/Shanghai", "week_start":1 }
Field meaning description
The entire json is a period field, see 4.2.3 periods field.
Response:
{ "code": 200, "message": "success", "data": { "app_id": 164314, "tag_name": "tag_testxxxx_wyx", "calculate_results": [ { "total": 28762, "details": [ { "name": "tag value 1", "count": 28762, "percent": 1.0, "pdate": "2022-05-05" } ], "trace_id": "8a23c9b6-0d05-4cee-a1b6-f2977a489581", "calculate_date": 1651728069000, "timezone": "Asia/Shanghai", "tag_status": "success", "begin_at": 1651728069000, "end_at": 1651728092000, "pdate": "2022-05-05", "p_date": "2022-05-05" } ], "has_history": true }, "total_execute_time": null }
Field meaning description
Data returns a JSON object, specifying key fields
Field | Type | Description |
|---|---|---|
app_id | int | App ID |
tag_name | string | label name |
calculate_results | array | Result set for query time period |
calculate_results.total | int | Total number of rows of data in the current partition time |
calculate_results.details | object | Data details for the current partition time |
calculate_results.details.name | string | label value |
calculate_results.details.count | int | The number of rows of data belonging to the label value |
calculate_results.details.percent | double | The proportion of the number of data rows belonging to the label value to the total number of data rows |
calculate_results.details.pdate | string | Redundant fields, same as calculate_results p_date |
calculate_results.calculate_date | int | The timestamp at which the current partition label calculation started |
calculate_results.timezone | string | The time zone of the current partition |
calculate_results.tag_status | string | The computing state of the current partition |
calculate_results.begin_at | int | Deprecated, timestamp at which the current partition label is calculated |
calculate_results.end_at | int | Deprecated, timestamp at the end of the calculation of the current partition label |
calculate_results.p_date | string | Current partition calculation date (recommended) |
Bc is the RangersClient created. For its initialization, please refer to the "OpenAPI SDK Instructions". SDKs in various languages provide similar interfaces.
Call (Python):
method = 'POST' service_url = '/datatag/openapi/v1/app/164314/tag/tag_testxxxx_wyx/result/history' body = { "granularity":"day", "type":"past_range", "spans":[ { "type":"past", "past":{ "amount":7, "unit":"day" } }, { "type":"past", "past":{ "amount":1, "unit":"day" } } ], "timezone":"Asia/Shanghai", "week_start":1 } resp = bc.request(method=method, service_url=service_url, body=body) print(resp.content.decode('utf-8'))
Return result:
{ "code": 200, "message": "success", "data": { "app_id": 164314, "tag_name": "tag_testxxxx_wyx", "calculate_results": [ { "total": 28762, "details": [ { "name": "tag value 1", "count": 28762, "percent": 1.0, "pdate": "2022-05-05" } ], "trace_id": "8a23c9b6-0d05-4cee-a1b6-f2977a489581", "calculate_date": 1651728069000, "timezone": "Asia/Shanghai", "tag_status": "success", "begin_at": 1651728069000, "end_at": 1651728092000, "pdate": "2022-05-05", "p_date": "2022-05-05" } ], "has_history": true }, "total_execute_time": null }