Method: devices.query

Gets the device states for the devices in QueryRequest. The third-party user's identity is passed in as agentUserId. The agent is identified by the JWT signed by the third-party partner's service account.

HTTP request

POST https://homegraph.googleapis.com/v1/devices:query

The URL uses gRPC Transcoding syntax.

Request body

The request body contains data with the following structure:

JSON representation
{
  "requestId": string,
  "agentUserId": string,
  "inputs": [
    {
      object (QueryRequestInput)
    }
  ]
}
Fields
requestId

string

Request ID used for debugging.

agentUserId

string

Required. Third-party user ID.

inputs[]

object (QueryRequestInput)

Required. Inputs containing third-party partner's device IDs for which to get the device states.

Response body

If successful, the response body contains data with the following structure:

Response type for the devices.query call. This should follow the same format as the Actions on Google action.devices.QUERY response.

Example
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "devices": {
      "123": {
        "on": true,
        "online": true
      },
      "456": {
        "on": true,
        "online": true,
        "brightness": 80,
        "color": {
          "name": "cerulean",
          "spectrumRGB": 31655
        }
      }
    }
  }
}
JSON representation
{
  "requestId": string,
  "payload": {
    object (QueryResponsePayload)
  }
}
Fields
requestId

string

Request ID used for debugging. Copied from the request.

payload

object (QueryResponsePayload)

Device states for the devices given in the request.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/homegraph

For more information, see the OAuth 2.0 Overview.

QueryRequestInput

Device ID inputs to QueryRequest.

JSON representation
{
  "payload": {
    object (QueryRequestPayload)
  }
}
Fields
payload

object (QueryRequestPayload)

Payload containing third-party partner's device IDs.

QueryRequestPayload

Payload containing device IDs.

JSON representation
{
  "devices": [
    {
      object (AgentDeviceId)
    }
  ]
}
Fields
devices[]

object (AgentDeviceId)

Third-party partner's device IDs for which to get the device states.

AgentDeviceId

Third-party partner's device ID for one device.

JSON representation
{
  "id": string
}
Fields
id

string

Third-party partner's device ID.

QueryResponsePayload

Payload containing device states information.

JSON representation
{
  "devices": {
    string: {
      object
    },
    ...
  }
}
Fields
devices

map (key: string, value: object (Struct format))

States of the devices. Map of third-party device ID to struct of device states.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.