Andamio LogoAndamio
Andamio API/Admin/API Usage

Get Any User Daily API Usage

AdminAPI Usage

This endpoint retrieves aggregated daily API usage data for administrators, allowing filtering by date range and a list of user information (alias and optional API key names).

POST
/admin/usage/any-user-daily-api-usage
Authorization<token>

Bearer token for authentication. Type "Bearer" followed by a space and JWT token. Example: "Bearer YOUR_JWT_TOKEN"

In: header

Any User Daily Usage Request Body - Contains filters for date range and user information.

end_datestring
start_datestring
user_infos?array<object>

Response Body

curl -X POST "https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/admin/usage/any-user-daily-api-usage" \
  -H "Content-Type: application/json" \
  -d '{
    "end_date": "2023-01-31",
    "start_date": "2023-01-01"
  }'
const body = JSON.stringify({
  "end_date": "2023-01-31",
  "start_date": "2023-01-01"
})

fetch("https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/admin/usage/any-user-daily-api-usage", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/admin/usage/any-user-daily-api-usage"
  body := strings.NewReader(`{
    "end_date": "2023-01-31",
    "start_date": "2023-01-01"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/admin/usage/any-user-daily-api-usage"
body = {
  "end_date": "2023-01-31",
  "start_date": "2023-01-01"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
import java.net.http.HttpRequest.BodyPublishers;

var body = BodyPublishers.ofString("""{
  "end_date": "2023-01-31",
  "start_date": "2023-01-01"
}""");
HttpClient client = HttpClient.newBuilder()
  .connectTimeout(Duration.ofSeconds(10))
  .build();

HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
  .uri(URI.create("https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/admin/usage/any-user-daily-api-usage"))
  .header("Content-Type", "application/json")
  .POST(body)
  .build();

try {
  HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
  System.out.println("Status code: " + response.statusCode());
  System.out.println("Response body: " + response.body());
} catch (Exception e) {
  e.printStackTrace();
}
using System;
using System.Net.Http;
using System.Text;

var body = new StringContent("""
{
  "end_date": "2023-01-31",
  "start_date": "2023-01-01"
}
""", Encoding.UTF8, "application/json");

var client = new HttpClient();
var response = await client.PostAsync("https://andamio-api-preprod-308006323670.us-central1.run.app/api/v1/admin/usage/any-user-daily-api-usage", body);
var responseBody = await response.Content.ReadAsStringAsync();
{
  "users_usages": [
    {
      "alias": "johndoe",
      "usages": [
        {
          "api_key_name": "MyFirstKey",
          "usage_data": [
            {
              "api_key_name": "MyFirstKey",
              "api_versions": [
                "[\"v1\"]"
              ],
              "authentication_methods": [
                "[\"API_KEY\"]"
              ],
              "date": "2023-01-01T00:00:00Z",
              "endpoints": [
                "[\"/v1/data\"]"
              ],
              "http_methods": [
                "[\"GET\"]"
              ],
              "max_response_time_ms": 500,
              "min_response_time_ms": 10,
              "tier_id": 1,
              "tier_name": "Free",
              "total_cache_hit_count": 100,
              "total_data_transfer_in_bytes": 1024000,
              "total_data_transfer_out_bytes": 2048000,
              "total_error_count": 50,
              "total_quota_exceeded_count": 2,
              "total_rate_limited_count": 5,
              "total_requests": 1000,
              "total_response_time_ms": 50000,
              "user_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
              "user_ips": [
                "[\"192.168.1.1\"]"
              ]
            }
          ]
        }
      ]
    }
  ]
}
{
  "details": "string",
  "message": "Bad Request: Invalid input.",
  "status_code": 400
}
{
  "details": "string",
  "message": "Unauthorized: Invalid or missing credentials.",
  "status_code": 401
}
{
  "details": "string",
  "message": "Forbidden: Insufficient permissions or tier access.",
  "status_code": 403
}
{
  "details": "string",
  "message": "Unprocessable Entity: Invalid request structure or data.",
  "status_code": 422
}
{
  "details": "string",
  "message": "Too Many Requests: Rate limit or quota exceeded.",
  "status_code": 429
}
{
  "details": "string",
  "message": "Internal Server Error: An unexpected error occurred.",
  "status_code": 500
}