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

Accepted Solutions
Mins
Conversationalist

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

/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

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

Have you got it formatted as an array?

gemini_yvr
Conversationalist

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

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

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

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

 

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

View solution in original post

CalebBartle
New here

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

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

Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.