Skip to content

API ca_dashboard Documentation

aaronskiba edited this page Jan 27, 2025 · 1 revision

Stats

The publicly available /stats endpoint provides the total number of created plans, orgs, and users.

GET /api/ca_dashboard/stats:

Format:

<BASE_URL>/api/ca_dashboard/stats
  • The all_time and last_30_days values are always returned. Example using curl:
curl -v GET https://localhost:3000/api/ca_dashboard/stats

Response:

The API will respond with an HTTP status of 200 and the following JSON output:

{
  "application": "DMP Assistant",
  "source": "GET /api/ca_dashboard/stats",
  "time": "2025-01-27T15:55:19-07:00",
  "caller": "129.128.216.14",
  "code": 200,
  "message": "OK",
  "total_items": 0,
  "stats": {
    "totals": {
      "all_time": {
        "plans": 15690,
        "orgs": 134,
        "users": 19389
      },
      "last_30_days": {
        "plans": 344,
        "orgs": 1,
        "users": 352
      }
    }
  }
}
  • Providing the optional start and end params with values in YYYY-MM-DD format enable a user to filter the totals over any date range of their choosing. Example using curl with optional params (can use one or both):
curl -v GET https://localhost:3000/api/ca_dashboard/stats?start=2024-01-01&end=2025-01-01

Response:

The API will respond with an HTTP status of 200 and the following JSON output:

{
  "application": "DMP Assistant",
  "source": "GET /api/ca_dashboard/stats",
  "time": "2025-01-27T16:01:46-07:00",
  "caller": "129.128.216.14",
  "code": 200,
  "message": "OK",
  "total_items": 0,
  "stats": {
    "totals": {
      "all_time": {
        "plans": 15692,
        "orgs": 134,
        "users": 19389
      },
      "last_30_days": {
        "plans": 346,
        "orgs": 1,
        "users": 352
      },
      "custom_range": {
        "plans": 2577,
        "orgs": 10,
        "users": 1895
      }
    }
  }
}
  • If the provided start or end parameters are not in the correct format (YYYY-MM-DD), the API will return an HTTP status code of 400 with an error message.
curl -v GET https://localhost:3000/api/ca_dashboard/stats?start=foo

Response:

{
  "application": "DMP Assistant",
  "source": "GET /api/ca_dashboard/stats",
  "time": "2025-01-27T16:04:30-07:00",
  "caller": "129.128.216.14",
  "code": 400,
  "message": "Bad Request",
  "total_items": 0,
  "items": [

  ],
  "errors": [
    [
      "Invalid date format. please use YYYY-MM-DD when supplying `start` or `end` params."
    ]
  ]
}