Hub.items.list API call

I have a device with an ID of: 60aaef71077e903f4a354448

If I make an API call using the following JSON:

{
“method”: “hub.items.list”,
“id”: “1624127755725”, <------- What do I supply here?
“params”: {
“deviceIds”: [
“60aaef71077e903f4a354448”
]
}
}

I get no results back:
{“api”:“1.0”,“error”:null,“id”:“1624127755725”,“result”:{“items”:[]}}

However, in the API tool, it works.

The only difference I see is that in the API tool, the “id” field (ex. “id”: “1624127755725”) is populated with a different ID each call.

What am I supposed to supply for that field in my code?

Thanks.

Hello @robotman,
The variable ID, in this case, refers to the identification number for the call. To list the items of this specific device, you may send the call like this:

{
  "method": "hub.items.list",
    "id": "_ID_",
    "params": {
      "deviceIds": [
        "60aaef71077e903f4a354448"
        ]
    }
}

In that way, the API will provide a different ID for the call every time.
Regards!

3 Likes

Thank you. (I stumbled across that also after trying things out). Appreciate it.

1 Like