import requests
url = "https://platform.ankra.app/api/v1/org/clusters/{cluster_id}/cost/namespaces/history"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/org/clusters/{cluster_id}/cost/namespaces/history', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/api/v1/org/clusters/{cluster_id}/cost/namespaces/history \
--header 'Authorization: Bearer <token>'{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency": "<string>",
"granularity": "day",
"days": 123,
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z",
"buckets": [
{
"start": "2023-11-07T05:31:56Z",
"hours": 123,
"attributed_hours": 123
}
],
"namespaces": [
{
"namespace": "<string>",
"stack_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cost_cents": [
123
],
"total_cents": 123
}
]
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}Get a cluster's namespace cost history (bearer twin)
One cluster’s namespace allocations over the window the metering keeps (35 days of hourly snapshots), in day buckets or, for at most 7 days, hour buckets, in the caller’s display currency. Each bucket says how many of its hours the metering attributed to namespaces; a namespace’s value for a bucket with none is null (unknown), never 0, and a namespace missing from an attributed hour was allocated nothing that hour. Nothing is extrapolated. Bearer-PAT twin of the browser route of the same name under /org.
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/{cluster_id}/cost/namespaces/history"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/org/clusters/{cluster_id}/cost/namespaces/history', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/api/v1/org/clusters/{cluster_id}/cost/namespaces/history \
--header 'Authorization: Bearer <token>'{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency": "<string>",
"granularity": "day",
"days": 123,
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z",
"buckets": [
{
"start": "2023-11-07T05:31:56Z",
"hours": 123,
"attributed_hours": 123
}
],
"namespaces": [
{
"namespace": "<string>",
"stack_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cost_cents": [
123
],
"total_cents": 123
}
]
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
PAT organisation override.
Path Parameters
Query Parameters
The window in days, 1 to 35 (at most 7 when granularity is hour); 30 by default, 7 for hour.
1 <= x <= 35The bucket size: day (the default) or hour.
day, hour Response
Successful response
day, hour The start of the first bucket (UTC).
The end of the window: now.
Show child attributes
Show child attributes
One series per namespace seen in the window, costliest first.
Show child attributes
Show child attributes