platform | device | language |
---|---|---|
windows, Android, iOS |
desktop, phone, tablet |
csharp, json |
- Introduction
- Device Queries
- Filter over a Device Property
- Filter over a Device property (not-equals)
- Filter over a Service property
- Filter over a Service property with aggregates
- Order-by
- Device Job Queries
- Filter jobs by status
- Order jobs by start time
About this document
This document contains sample JSON snippets for various device and job queries that can be performed via the Device Management public preview APIs.
Note that for csharp the snippets have to be modified to escape all the double quote characters. This is as simple as pasting in the cs code file and replacing every double quote character with two double quotes instead of one. I.e, " -> ""
Get all devices where the FirmwareVersion Device property is set to 1.0
{
"filter": {
"property": {
"name": "FirmwareVersion",
"type": "device"
},
"value": "1.0",
"comparisonOperator": "eq",
"type": "comparison"
}
}
Filter over a Device property (not-equals)
Get all devices where the FirmwareVersion Device property is not set to 1.0
{
"filter": {
"property": {
"name": "FirmwareVersion",
"type": "device"
},
"value": "1.0",
"comparisonOperator": "ne",
"type": "comparison"
}
}
Filter over a Service property
Get all devices where CustomerId Service property is set to 123456
{
"filter": {
"property": {
"name": "CustomerId",
"type": "service"
},
"value": "123456",
"comparisonOperator": "eq",
"type": "comparison"
}
}
Filter over a Service property with aggregates
Group by the CustomerId Service prooperty and get sum of Weight Service property for all devices where CustomerId Service property is present.
{
"filter": {
"property": {
"name": "CustomerId",
"type": "service"
},
"value": null,
"comparisonOperator": "ne",
"type": "comparison"
},
"aggregate": {
"keys": [
{
"name": "CustomerId",
"type": "service"
}
],
"properties": [
{
"operator": "sum",
"property": {
"name": "Weight",
"type": "service"
},
"columnName": "TotalWeight"
}
]
},
"sort": []
}
Return all devices ordered by the QoS Service property.
{
"sort": [
{
"property": {
"name": "QoS",
"type": "service"
},
"order": "asc"
}
]
}
Get all device jobs where status of the job is set to Running.
{
"filter": {
"property": {
"name": "Status",
"type": "default"
},
"value": "Running",
"comparisonOperator": "eq",
"type": "comparison"
}
}
Get all device jobs ordered by StartTimeUtc
{
"sort": [
{
"property": {
"name": "StartTimeUtc",
"type": "default"
},
"order": "desc"
}
]
}