Skip to content

affandar/simple-bpms

Repository files navigation

platform device language
windows, Android, iOS
desktop, phone, tablet
csharp, json

Device Management Query Sample Snippets


Table of Contents

Introduction

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, " -> ""

Device Queries

Filter over a Device Property

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": []
}

Order-by

Return all devices ordered by the QoS Service property.

{
    "sort": [
        {
            "property": {
                "name": "QoS",
                "type": "service"
            },
            "order": "asc"
        }
    ]
}

Device Job Queries

Filter jobs by status

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"
    }
}

Order jobs by start time

Get all device jobs ordered by StartTimeUtc

{
    "sort": [
        {
            "property": {
                "name": "StartTimeUtc",
                "type": "default"
            },
            "order": "desc"
        }
    ]
}

About

Playing around with BPMS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages