Enumerating Device Statistics

You can get the statistics of devices of your own company and your customers using the EnumerateAccountStatistics method. A common use of this method is to output a list of storage space used on the cloud per device. You can get this information by using the Columns parameter and using the column I14.

🚧

Please be aware that there are no methods which can perform complex calculations, however the Totals parameter can do basic calculations using column codes. If you need to do complex calculations, you will have to take the given sizes (in Bytes) and do these manually.

Required parameters

ParameterDescriptionSupported values
queryA group of parameters related to the device statisticsAccountStatisticsQuery (has child parameters of its own, see the AccountStatisticsQuery child parameters table below)

AccountStatisticsQuery child parameters

Parameter

Description

Supported values

PartnerId

The ID of the customer the device is created for (retrieved through the GetPartnerInfo method)

<int> Integer

Filter

Apply a search parameter using RegularExpression (RegEx)

<std::string>

ExcludedPartners

A list of partner ID's to exclude from the search

IdSet

SelectionMode

An array of selection modes

AccountStatistics
SelectionMode::Enum

Undefined
Merged
PerInstallation
Count

Labels

Any labels to display

<int>

StartRecordNumber

Which device number to start the output from

<int>

RecordsCount

How many devices to display.

<int>

OrderBy

How to order the displayed list of results

<std::string>

Columns

Which column vectors you wish to display in the response

ColumnVector
(see API Column Codes for all options)

Totals

An array of totals represented as strings, will return totalStatistics.

For Example: merateAccountStatistics meth,

This will return totalStatistics with the sum of used storage for the selected partner and filter and also a count of Cloud2Cloud devices

TotalVector

  • SUM
  • COUNT
  • MAX
  • MIN

📘

Some column codes return data only for devices where the property is populated. Use a larger RecordsCount value to ensure results are returned.

Sample request

{
    "jsonrpc":"2.0",
    "id":"jsonrpc",
    "visa": "{{visa}}",
    "method" : "EnumerateAccountStatistics",
    "params" : {
	"query" : {
		"PartnerId" : 123456,
		"Filter": "ANY =~ 'Device*'",
		"SelectionMode": "Merged",
		"StartRecordNumber": 0,
		"RecordsCount": 3,
		"Columns": ["I1", "I14", "I18", "Do9F00", "D01F07"]
	}
    }			
}

Sample response

{
    "id": "jsonrpc",
    "jsonrpc": "2.0",
    "result": {
	"result": [
	    {
		"AccountId": 654321,
		"Flags": [
		    "AutoDeployed"
		],
		"PartnerId": 123456,
		"Settings": [
		    {
			"I1": "computerName"
		    },
		    {
			"I14": "0"
		    },
		    {
			"I78": "D01D02"
		    }
		]
	    },
	    {
		"AccountId": 765432,
		"Flags": null,
		"PartnerId": 456789,
		"Settings": [
		    {
			"D01F07": "28349567768726"
		    },
		    {
			"D09F00": "1"
		    },
		    {
			"I1": "computerName2"
		    },
		    {
			"I14": "586755749630"
		    },
		    {
			"I78": "D01D02"
		    }
		]
	    },
	    {
		"AccountId": 876543,
		"Flags": null,
		"PartnerId": 456789,
		"Settings": [
		    {
			"D09F00": "5"
		    },
		    {
			"I1": "computerName3"
		    },
		    {
			"I14": "23630480"
		    },
		    {
			"I78": "D19D20D05"
		    }
		]
	    }
	],
	"totalStatistics": null
    },
    "visa": "{{visa}}"
}

Response structure

EnumerateAccountStatistics returns data in two locations:

Top-level properties

Every response includes these fixed properties, regardless of which column codes you request:

PropertyDescription
AccountIdDevice account ID (equivalent to the AU column code).
FlagsAccount flags array (equivalent to the AN column code).
PartnerIdPartner ID the device belongs to.

Settings array

Requested column codes are returned in the Settings array. Each entry is an object with a single property, where the key is the column code and the value is the result.

"Settings": [
    { "I1": "computerName" },
    { "I14": "188702358870" },
    { "I78": "D01D02" },
    { "MA": "10:b6:76:26:ce:36" }
]

To access a specific value, filter the array by property name:

$device = $response.result.result[0]

# Access a single value
$hostname = ($device.Settings | Where-Object { $_.I1 }).I1

# Convert the full array to a hashtable for multiple lookups
$settings = @{}
$device.Settings | ForEach-Object {
    $_.PSObject.Properties | ForEach-Object {
        $settings[$_.Name] = $_.Value
    }
}

$hostname = $settings['I1']
$storage  = $settings['I14']
$sources  = $settings['I78']
📘

The API silently ignores unrecognized or incorrectly formatted codes without returning an error