API Sensor Latest Data Returning Sensors But No Data

bsmith
Comes here often

API Sensor Latest Data Returning Sensors But No Data

Running the below in powershell returns my sensors, however, there are no values returned with the data, example return data shown below, note that it returns the sensors and has the headers for the parameters, but no values are included. If I run the history command, I get values returned. If I run the same query in the Meraki API documentation page for testing, it returns values as expected.

$APIKey = "xxxxxxxxxxxxxxxxxxxxx"
$orgid = "xxxxxx"
$headers = @{
"Content-Type" = "application/json"
"Accept" = "application/json"
"X-Cisco-Meraki-API-Key" = $APIKey
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Ssl3


$suri = "https://api.meraki.com/api/v1/organizations/$orgid/sensor/readings/latest"
Invoke-RestMethod -Method Get -Uri $suri -Headers $Headers | fl
 serial : xxxx-xxxx-xxxx
network : @{id=xxxxxxxxxxxxx; name=xxxxxx}
readings : {@{ts=2022-10-19T23:06:47Z; metric=battery; battery=}, @{ts=2022-10-19T23:06:47Z;
metric=humidity; humidity=}, @{ts=2022-10-19T23:06:47Z; metric=temperature; temperature=}}
serial : yyyy-yyyy-yyyy
network : @{id=xxxxxxxxxxxxx; name=xxxxxx}
readings : {@{ts=2022-10-19T23:05:51Z; metric=battery; battery=}, @{ts=2022-10-19T23:05:50Z; metric=water;
water=}}

 

1 Reply 1
sungod
Head in the Cloud

I just tried it, data returned ok on all sensors.

 

Have you tried running it via the developer test page to eliminate a client issue?

 

https://developer.cisco.com/meraki/api-v1/#!get-organization-sensor-readings-latest

 

 

Get notified when there are additional replies to this discussion.