cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5750
Views
2
Helpful
4
Replies

Error on api v1 for /networks/:networkId/sm/devices?fields={{fields}}

Mins
Community Member

Hi ,

I was trying to add additional fields to return for SM Devices.

eg: /networks/:networkId/sm/devices?fields=systemType,deviceCapacity

But I am finding this error

{
"errors": [
"'fields' must be an array"
]
}
The same is working for api v0.
Any thoughts.?
1 Accepted Solution

Accepted Solutions

Mins
Community Member

/networks/:networkId/sm/devices?fields[]={{fields}}

I was trying some error and trial and the above worked for me.

View solution in original post

4 Replies 4

Philip D'Ath
Meraki Community All-Star
Meraki Community All-Star

Have you got it formatted as an array?

I've noticed this as well, particularly as a v0 to v1 problem.

The documentation for v0 actually states to use a comma-separated string for fields, which works for v0.


https://developer.cisco.com/meraki/api/#!get-network-sm-devices

This fails in v1. Trying to use an array doesn't work either.

This works (v0):

https://api.meraki.com/api/v0/networks/{{networkId}}/sm/devices?fields=id,name,lastUser,ownerEmail,ownerUsername

These do not (v1):

https://api.meraki.com/api/v1/networks/{{networkId}}/sm/devices?fields=id,name,lastUser,ownerEmail,ownerUsername

https://api.meraki.com/api/v1/networks/{{networkId}}/sm/devices?fields=[id,name,lastUser,ownerEmail,ownerUsername]

https://api.meraki.com/api/v1/networks/{{networkId}}/sm/devices?fields=['id','name','lastUser','ownerEmail','ownerUsername']

Mins
Community Member

/networks/:networkId/sm/devices?fields[]={{fields}}

I was trying some error and trial and the above worked for me.

CalebBartle
Community Member

The following API call on version 1 should allow this to work for anyone who is curious:

{{baseUrl}}/networks/:networkId/sm/devices?fields[]=id,name