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

Solved
Mins
Conversationalist

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

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
Mins
Conversationalist

/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
PhilipDAth
Kind of a big deal
Kind of a big deal

Have you got it formatted as an array?

gemini_yvr
Conversationalist

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
Conversationalist

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

 

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

CalebBartle
New here

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

Get notified when there are additional replies to this discussion.