orgsStats := client.OrgsStats()
OrgsStats
Get Org Stats
GetOrgStats(
ctx context.Context,
orgId uuid.UUID,
start *int,
end *int,
duration *string,
limit *int,
page *int) (
models.ApiResponse[models.StatsOrg],
error)
Parameter | Type | Tags | Description |
---|---|---|---|
orgId |
uuid.UUID |
Template, Required | - |
start |
*int |
Query, Optional | start datetime, can be epoch or relative time like -1d, -1w; -1d if not specified |
end |
*int |
Query, Optional | end datetime, can be epoch or relative time like -1d, -2h; now if not specified |
duration |
*string |
Query, Optional | duration like 7d, 2w Default: "1d" |
limit |
*int |
Query, Optional | Default: 100 Constraints: >= 0 |
page |
*int |
Query, Optional | Default: 1 Constraints: >= 1 |
ctx := context.Background()
orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")
duration := "10m"
limit := 100
page := 1
apiResponse, err := orgsStats.GetOrgStats(ctx, orgId, nil, nil, &duration, &limit, &page)
if err != nil {
log.Fatalln(err)
} else {
// Printing the result and response
fmt.Println(apiResponse.Data)
fmt.Println(apiResponse.Response.StatusCode)
}
{
"alarmtemplate_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"allow_mist": true,
"created_time": 0,
"id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"modified_time": 0,
"msp_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"name": "string",
"num_devices": 0,
"num_devices_connected": 0,
"num_devices_disconnected": 0,
"num_inventory": 0,
"num_sites": 0,
"orggroup_ids": [
"b069b358-4c97-5319-1f8c-7c5ca64d6ab1"
],
"session_expiry": 0,
"sle": [
{
"path": "string",
"user_minutes": {
"ok": 0,
"total": 0
}
}
]
}
HTTP Status Code | Error Description | Exception Class |
---|---|---|
400 | Bad Syntax | ResponseHttp400Exception |
401 | Unauthorized | ResponseHttp401ErrorException |
403 | Permission Denied | ResponseHttp403ErrorException |
404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | ResponseHttp404Exception |
429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | ResponseHttp429ErrorException |