Simple queries

These queries fetch an asset with the specified fields. Use the Asset Type you have defined as the object in the query. For e.g. to get all assets of type car, execute the below query.

query {
    car{
        Id
        make
        color
    }
}

Response:

{
    "data": {
        "car_count": 2,
        "car": [
            {
                "Id": "car1",
                "make": "ford",
                "color": "red"
            },
            {
                "Id": "car2",
                "make": "chysler"
                "color": "white"
            }
        ]
    }
}

Simple condition

Specify a simple condition by including a key, value pair as an argument to the Asset Type. For e.g. the below query gets all car assets which have red color.

query {
    car (color: "red"){
        Id
        make
        color
    }
}

Response:

{
    "data": {
        "car_count": 1,
        "car": [
            {
                "Id": "car1",
                "make": "ford",
                "color": "red"
            }
        ]
    }
}

Multiple conditions

Specify multiple conditions by including multiple comma separated key, value pairs as an argument to the Asset Type. When you specify multiple conditions like this, the conditions are combined using the "and" operator. For e.g. get all car assets where color is red and make is ford.

query {
    car (color: "red", make: "ford"){
        Id
        make
        color
    }
}

Response:

{
    "data": {
        "car_count": 1,
        "car": [
            {
                "Id": "car1",
                "make": "ford",
                "color": "red"
            }
        ]
    }
}

Last updated