# Metric

## returns number of requests with lat and lon, based on geoip

> this is mostly useful for heatmaps

```json
{"openapi":"3.1.1","info":{"title":"api.cdn.i3d.net","version":"ed6131ed-256"},"servers":[{"url":"https://api.cdn.i3d.net/api/"}],"security":[{"OAuth2Application":[]}],"components":{"securitySchemes":{"OAuth2Application":{"type":"oauth2","flows":{"application":{"tokenUrl":"https://id.i3d.net/connect/token"}}}},"schemas":{"model.GeoItemRequest":{"type":"object","properties":{"location":{"type":"object","properties":{"lat":{"type":"number"},"lon":{"type":"number"}}},"requests":{"type":"integer"}}},"model.HTTPError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/service/{serviceId}/metric/geopoints":{"get":{"description":"this is mostly useful for heatmaps","tags":["metric"],"summary":"returns number of requests with lat and lon, based on geoip","parameters":[{"type":"string","description":"serviceId","name":"serviceId","in":"path","required":true},{"type":"integer","description":"start time range,  unix timestamp, default 24 hours ago","name":"startTimestamp","in":"query"},{"type":"integer","description":"end time range, unix timestamp, default now","name":"endTimestamp","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/model.GeoItemRequest"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}}}}}}}
```

## Returns the number of values for a metric

> Returns the number of values for a metric

```json
{"openapi":"3.1.1","info":{"title":"api.cdn.i3d.net","version":"ed6131ed-256"},"servers":[{"url":"https://api.cdn.i3d.net/api/"}],"security":[{"OAuth2Application":[]}],"components":{"securitySchemes":{"OAuth2Application":{"type":"oauth2","flows":{"application":{"tokenUrl":"https://id.i3d.net/connect/token"}}}},"schemas":{"model.CountRequests":{"type":"object","properties":{"key":{"type":"string"},"requests":{"type":"integer"}}},"model.HTTPError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/service/{serviceId}/metric/{field}/count/requests":{"get":{"description":"Returns the number of values for a metric","tags":["metric"],"summary":"Returns the number of values for a metric","parameters":[{"type":"string","description":"serviceId","name":"serviceId","in":"path","required":true},{"type":"string","description":"Field from list of /api/util/fields","name":"field","in":"path","required":true},{"type":"integer","description":"start time range,  unix timestamp, default 24 hours ago","name":"startTimestamp","in":"query"},{"type":"integer","description":"end time range, unix timestamp, default now","name":"endTimestamp","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.CountRequests"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}}}}}}}
```

## Returns the number of unique values for a metric

> Returns the number of unique values for a metric

```json
{"openapi":"3.1.1","info":{"title":"api.cdn.i3d.net","version":"ed6131ed-256"},"servers":[{"url":"https://api.cdn.i3d.net/api/"}],"security":[{"OAuth2Application":[]}],"components":{"securitySchemes":{"OAuth2Application":{"type":"oauth2","flows":{"application":{"tokenUrl":"https://id.i3d.net/connect/token"}}}},"schemas":{"model.CountRequests":{"type":"object","properties":{"key":{"type":"string"},"requests":{"type":"integer"}}},"model.HTTPError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/service/{serviceId}/metric/{field}/countUnique/requests":{"get":{"description":"Returns the number of unique values for a metric","tags":["metric"],"summary":"Returns the number of unique values for a metric","parameters":[{"type":"string","description":"serviceId","name":"serviceId","in":"path","required":true},{"type":"string","description":"Field from list of /api/util/fields","name":"field","in":"path","required":true},{"type":"integer","description":"start time range,  unix timestamp, default 24 hours ago","name":"startTimestamp","in":"query"},{"type":"integer","description":"end time range, unix timestamp, default now","name":"endTimestamp","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.CountRequests"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}}}}}}}
```

## Returns the Histogram of field by request count

> Returns the Histogram of field by request count

```json
{"openapi":"3.1.1","info":{"title":"api.cdn.i3d.net","version":"ed6131ed-256"},"servers":[{"url":"https://api.cdn.i3d.net/api/"}],"security":[{"OAuth2Application":[]}],"components":{"securitySchemes":{"OAuth2Application":{"type":"oauth2","flows":{"application":{"tokenUrl":"https://id.i3d.net/connect/token"}}}},"schemas":{"model.HistogramItemRequests":{"type":"object","properties":{"date":{"type":"string"},"histogram":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/model.HistogramRequestsBucket"}}}},"model.HistogramRequestsBucket":{"type":"object","properties":{"requests":{"type":"integer"}}},"model.HTTPError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/service/{serviceId}/metric/{field}/histogram/requests":{"get":{"description":"Returns the Histogram of field by request count","tags":["metric"],"summary":"Returns the Histogram of field by request count","parameters":[{"type":"string","description":"serviceId","name":"serviceId","in":"path","required":true},{"type":"string","description":"Field from list of /api/util/fields","name":"field","in":"path","required":true},{"type":"integer","description":"Limit (max 1000, default 10)","name":"limit","in":"query"},{"type":"integer","description":"start time range,  unix timestamp, default 24 hours ago","name":"startTimestamp","in":"query"},{"type":"integer","description":"end time range, unix timestamp, default now","name":"endTimestamp","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/model.HistogramItemRequests"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}}}}}}}
```

## Returns the Histogram of field by traffic

> Returns the Histogram of field by traffic

```json
{"openapi":"3.1.1","info":{"title":"api.cdn.i3d.net","version":"ed6131ed-256"},"servers":[{"url":"https://api.cdn.i3d.net/api/"}],"security":[{"OAuth2Application":[]}],"components":{"securitySchemes":{"OAuth2Application":{"type":"oauth2","flows":{"application":{"tokenUrl":"https://id.i3d.net/connect/token"}}}},"schemas":{"model.HistogramItemTraffic":{"type":"object","properties":{"date":{"type":"string"},"histogram":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/model.HistogramTrafficBucket"}}}},"model.HistogramTrafficBucket":{"type":"object","properties":{"tx":{"type":"integer"}}},"model.HTTPError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/service/{serviceId}/metric/{field}/histogram/traffic":{"get":{"description":"Returns the Histogram of field by traffic","tags":["metric"],"summary":"Returns the Histogram of field by traffic","parameters":[{"type":"string","description":"serviceId","name":"serviceId","in":"path","required":true},{"type":"string","description":"Field from list of /api/util/fields","name":"field","in":"path","required":true},{"type":"integer","description":"Limit (max 1000, default 10)","name":"limit","in":"query"},{"type":"integer","description":"start time range,  unix timestamp, default 24 hours ago","name":"startTimestamp","in":"query"},{"type":"integer","description":"end time range, unix timestamp, default now","name":"endTimestamp","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/model.HistogramItemTraffic"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}}}}}}}
```

## Returns a number of stats about a field

> Returns a number of stats about a field

```json
{"openapi":"3.1.1","info":{"title":"api.cdn.i3d.net","version":"ed6131ed-256"},"servers":[{"url":"https://api.cdn.i3d.net/api/"}],"security":[{"OAuth2Application":[]}],"components":{"securitySchemes":{"OAuth2Application":{"type":"oauth2","flows":{"application":{"tokenUrl":"https://id.i3d.net/connect/token"}}}},"schemas":{"model.Stats":{"type":"object","properties":{"avg":{"type":"number"},"count":{"type":"integer"},"key":{"type":"string"},"max":{"type":"number"},"min":{"type":"number"},"std_deviation":{"type":"number"},"sum":{"type":"number"},"sum_of_squares":{"type":"number"},"variance":{"type":"number"}}},"model.HTTPError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/service/{serviceId}/metric/{field}/stats":{"get":{"description":"Returns a number of stats about a field","tags":["metric"],"summary":"Returns a number of stats about a field","parameters":[{"type":"string","description":"serviceId","name":"serviceId","in":"path","required":true},{"type":"string","description":"Field from list of /api/util/fields","name":"field","in":"path","required":true},{"type":"integer","description":"start time range,  unix timestamp, default 24 hours ago","name":"startTimestamp","in":"query"},{"type":"integer","description":"end time range, unix timestamp, default now","name":"endTimestamp","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.Stats"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}}}}}}}
```

## Returns the top x of field by request count

> Returns the top x of field by request count

```json
{"openapi":"3.1.1","info":{"title":"api.cdn.i3d.net","version":"ed6131ed-256"},"servers":[{"url":"https://api.cdn.i3d.net/api/"}],"security":[{"OAuth2Application":[]}],"components":{"securitySchemes":{"OAuth2Application":{"type":"oauth2","flows":{"application":{"tokenUrl":"https://id.i3d.net/connect/token"}}}},"schemas":{"model.TopListRequests":{"type":"object","properties":{"topList":{"type":"array","items":{"$ref":"#/components/schemas/model.TopListItemRequests"}}}},"model.TopListItemRequests":{"type":"object","properties":{"key":{"type":"string"},"requests":{"type":"integer"}}},"model.HTTPError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/service/{serviceId}/metric/{field}/top/requests":{"get":{"description":"Returns the top x of field by request count","tags":["metric"],"summary":"Returns the top x of field by request count","parameters":[{"type":"string","description":"serviceId","name":"serviceId","in":"path","required":true},{"type":"string","description":"Field from list of /api/util/fields","name":"field","in":"path","required":true},{"type":"integer","description":"Limit (max 1000, default 10)","name":"limit","in":"query"},{"type":"integer","description":"start time range,  unix timestamp, default 24 hours ago","name":"startTimestamp","in":"query"},{"type":"integer","description":"end time range, unix timestamp, default now","name":"endTimestamp","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.TopListRequests"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}}}}}}}
```

## Returns the top x of field by traffic amount in bytes

> Returns the top x of field by traffic amount in bytes

```json
{"openapi":"3.1.1","info":{"title":"api.cdn.i3d.net","version":"ed6131ed-256"},"servers":[{"url":"https://api.cdn.i3d.net/api/"}],"security":[{"OAuth2Application":[]}],"components":{"securitySchemes":{"OAuth2Application":{"type":"oauth2","flows":{"application":{"tokenUrl":"https://id.i3d.net/connect/token"}}}},"schemas":{"model.TopListData":{"type":"object","properties":{"topList":{"type":"array","items":{"$ref":"#/components/schemas/model.TopListItemData"}}}},"model.TopListItemData":{"type":"object","properties":{"key":{"type":"string"},"tx":{"type":"integer"}}},"model.HTTPError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/service/{serviceId}/metric/{field}/top/traffic":{"get":{"description":"Returns the top x of field by traffic amount in bytes","tags":["metric"],"summary":"Returns the top x of field by traffic amount in bytes","parameters":[{"type":"string","description":"serviceId","name":"serviceId","in":"path","required":true},{"type":"string","description":"Field from list of /api/util/fields","name":"field","in":"path","required":true},{"type":"integer","description":"Limit (max 1000, default 10)","name":"limit","in":"query"},{"type":"integer","description":"start time range,  unix timestamp, default 24 hours ago","name":"startTimestamp","in":"query"},{"type":"integer","description":"end time range, unix timestamp, default now","name":"endTimestamp","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.TopListData"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HTTPError"}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.i3d.net/api-references/cdn/metric-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
