Get Metric Tags Information¶
GET /api/v1/metric_info/measurement/tags
Overview¶
Sample and retrieve the values of a Tag in a specified Measurement.
Before You Call and Usage Steps¶
The query scope is the current day in the Workspace time zone. When no data meets the conditions, the result field is an empty array. The response returns some non-null values and cannot be used to enumerate all historical values. null, empty strings, 0, and false in upstream query results are excluded from the sample list. If the Measurement name or Tag name is left empty, the request returns success with content as {}.
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | AK identifier used for authentication Example: <DF-API-KEY>How to obtain or enter: Create or obtain a Key with permissions for this API in API Key Management of the target Workspace. |
Query Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| measurement | string | Y | Exact name of the Measurement, for example, cpu. Allowed null: False Example: cpuHow to obtain or enter: Take the value from content.data[].name in the response of Get Measurement List. |
| tag | string | Y | Specify a Tag name, for example, host. Allowed null: False Example: hostHow to obtain or enter: Take the value from content.fields[].tags[].name in the response of Get Measurement Schema. |
| limit | integer | Default 10. Values greater than 10 are treated as 10. Pass a positive integer. Allowed null: True Default value: 10 Example: 10How to obtain or enter: Set based on the number of samples required by the caller; 1 to 10 is recommended. |
Additional Parameter Notes¶
Use GET to read data from the Workspace to which the current API Key belongs.
Request Example¶
curl --get -H "DF-API-KEY: <DF-API-KEY>" \
"https://openapi.truewatch.com/api/v1/metric_info/measurement/tags" \
--data-urlencode "measurement=cpu" \
--data-urlencode "tag=host" \
--data-urlencode "limit=10"
Response¶
HTTP 200, application/json.
| Field | Type | Description |
|---|---|---|
| content.measurement | string | Measurement name in the request. |
| content.tag | string | Field or Tag name in the request. |
| content.values | array | Sampled values. Element types depend on the data source field; when no values match, this is an empty array. |
| content.declaration | object or null | Workspace public declaration attached to non-empty content. When not configured, it may be null or an empty object; it is not added for an empty content object. |
{
"code": 200,
"content": {
"measurement": "cpu",
"tag": "host",
"values": [
"web-01",
"web-02"
],
"declaration": null
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Resolution |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A required Query parameter is missing, or an undeclared Query parameter is specified | Request field validation failed; the message indicates the field or rule. | Check the parameter table and example. |
| 403 | ft.ForbiddenQuery | The current credential is not authorized to query the data corresponding to the request | Insufficient query permissions. | Check the API Key query permissions and the authorization scope of the target data. |
| 503 | ft.QueryServiceUnavailable | The dependent query service is temporarily unavailable | The query service is temporarily unavailable. Try again later. | Check content.retryable; for transient errors, retry after a delay. |
| 500 | ft.InternalServerError | The limit value is a string that cannot be converted to an integer | Internal error. | Check the pagination field used via the parameter table, pass a decimal integer string, and retry. |