Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
usage_total = client.storage.statistics.get_usage_aggregated()
print(usage_total.data)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
"github.com/G-Core/gcore-go/storage"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
usageTotal, err := client.Storage.Statistics.GetUsageAggregated(context.TODO(), storage.StatisticGetUsageAggregatedParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", usageTotal.Data)
}
curl --request POST \
--url https://api.gcore.com/storage/stats/v1/storage/usage/total \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "2006-01-02",
"locations": [
"s-region-1",
"s-region-2"
],
"storages": [
"123-myStorage"
],
"to": "2006-01-02"
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: '2006-01-02',
locations: ['s-region-1', 's-region-2'],
storages: ['123-myStorage'],
to: '2006-01-02'
})
};
fetch('https://api.gcore.com/storage/stats/v1/storage/usage/total', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/storage/stats/v1/storage/usage/total",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => '2006-01-02',
'locations' => [
's-region-1',
's-region-2'
],
'storages' => [
'123-myStorage'
],
'to' => '2006-01-02'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/storage/stats/v1/storage/usage/total")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"2006-01-02\",\n \"locations\": [\n \"s-region-1\",\n \"s-region-2\"\n ],\n \"storages\": [\n \"123-myStorage\"\n ],\n \"to\": \"2006-01-02\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/storage/stats/v1/storage/usage/total")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"2006-01-02\",\n \"locations\": [\n \"s-region-1\",\n \"s-region-2\"\n ],\n \"storages\": [\n \"123-myStorage\"\n ],\n \"to\": \"2006-01-02\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"metrics": {
"file_quantity_sum_max": 123,
"requests_in_sum": 123,
"requests_out_edges_sum": 123,
"requests_out_wo_edges_sum": 123,
"requests_sum": 123,
"size_sum_bytes_hour": 123,
"size_sum_max": 123,
"size_sum_mean": 123,
"traffic_in_sum": 123,
"traffic_out_edges_sum": 123,
"traffic_out_wo_edges_sum": 123,
"traffic_sum": 123
}
}
]
}{
"error": "<string>"
}Storage Statistics
Storage usage total
Consumption statistics is updated in near real-time as a standard practice. However, the frequency of updates can vary, but they are typically available within a 60 minutes period. Exceptions, such as maintenance periods, may delay data beyond 60 minutes until servers resume and backfill missing statistics.
Shows storage total usage data in filtered by storages, locations and interval.
POST
/
storage
/
stats
/
v1
/
storage
/
usage
/
total
Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
usage_total = client.storage.statistics.get_usage_aggregated()
print(usage_total.data)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
"github.com/G-Core/gcore-go/storage"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
usageTotal, err := client.Storage.Statistics.GetUsageAggregated(context.TODO(), storage.StatisticGetUsageAggregatedParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", usageTotal.Data)
}
curl --request POST \
--url https://api.gcore.com/storage/stats/v1/storage/usage/total \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "2006-01-02",
"locations": [
"s-region-1",
"s-region-2"
],
"storages": [
"123-myStorage"
],
"to": "2006-01-02"
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: '2006-01-02',
locations: ['s-region-1', 's-region-2'],
storages: ['123-myStorage'],
to: '2006-01-02'
})
};
fetch('https://api.gcore.com/storage/stats/v1/storage/usage/total', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/storage/stats/v1/storage/usage/total",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => '2006-01-02',
'locations' => [
's-region-1',
's-region-2'
],
'storages' => [
'123-myStorage'
],
'to' => '2006-01-02'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/storage/stats/v1/storage/usage/total")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"2006-01-02\",\n \"locations\": [\n \"s-region-1\",\n \"s-region-2\"\n ],\n \"storages\": [\n \"123-myStorage\"\n ],\n \"to\": \"2006-01-02\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/storage/stats/v1/storage/usage/total")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"2006-01-02\",\n \"locations\": [\n \"s-region-1\",\n \"s-region-2\"\n ],\n \"storages\": [\n \"123-myStorage\"\n ],\n \"to\": \"2006-01-02\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"metrics": {
"file_quantity_sum_max": 123,
"requests_in_sum": 123,
"requests_out_edges_sum": 123,
"requests_out_wo_edges_sum": 123,
"requests_sum": 123,
"size_sum_bytes_hour": 123,
"size_sum_max": 123,
"size_sum_mean": 123,
"traffic_in_sum": 123,
"traffic_out_edges_sum": 123,
"traffic_out_wo_edges_sum": 123,
"traffic_sum": 123
}
}
]
}{
"error": "<string>"
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234$abcdef
Body
application/json
Response
StorageUsageTotalEndpointRes
StorageUsageTotalRes for response
Show child attributes
Show child attributes
Was this page helpful?
⌘I