cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3195
Views
5
Helpful
6
Replies

getDevice and updateDevice doesn't work

churches_co
Community Member

I'm making a simple web-application for a client using the Meraki API. But neither of the two requests that is needed for the application is working and I cannot seem to get what is wrong. It's regarding the get-request getDevice and put-request updateDevice. All I receive is 404.

This is for the get-request:

curl -L --request GET \

--url https://api.meraki.com/api/v1/devices/XXXXXXXXXXXX \

--header 'Content-Type: application/json' \

--header 'Accept: application/json' \

--header 'X-Cisco-Meraki-API-Key: [my api key]'

and this is for the put-request:

curl -L --request PUT \

--url https://api.meraki.com/api/v1/devices/XXXXXXXXXXXX \

--header 'Content-Type: application/json' \

--header 'Accept: application/json' \

--header 'X-Cisco-Meraki-API-Key: [my api key]'

(i'm usually doing all of this in postman in then I have a body of course for the put-request)

i've also tried tried adding networks/network_id along with /sm in the path, but nothing is working and the documentation doesn't provide any answer whatsoever. And yes my key is valid, i can still get all the devices from a certain network and such. And I've made sure that the device is not in the inventory but in an actual network. Any ideas or has anyone had the same problem?

6 Replies 6

aleabrahao
Meraki Community All-Star
Meraki Community All-Star

First, ensure you have the right network permission(which I assume you already have as you can get the organization list). Then try the below curl command to rule out any library issues.

curl -L --request GET \
--url https://api.meraki.com/api/v1/devices/[YOUR SERIAL NUMBER] \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-Cisco-Meraki-API-Key: [YOUR API KEY]'

I am not a Cisco employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.

I may be wrong, but what you wrote is identical to mine. Is it working for you that request?

aleabrahao
Meraki Community All-Star
Meraki Community All-Star

Yes, the commands you are running are correct. Just check if you have the correct network permission, if the S/N and API key are correct.

If everything is ok, I suggest you open a support case.

I am not a Cisco employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.

Yeah I opened a case, thanks for the help!

Rasmus Hoffmann Birkelund
Meraki Community All-Star
Meraki Community All-Star

Try updating your curl command to use the Bearer authorization instead.

curl -L --request GET \
--url https://api.meraki.com/api/v1/devices/{serial} \
--header 'Authorization: Bearer 75dd5334bef4d2bc96f26138c163c0a3fa0b5ca6' \
--header 'Accept: application/json'

https://developer.cisco.com/meraki/api-v1/get-device/

#########
LinkedIn ::: https://blog.rhbirkelund.dk/
Like what you see? - Mark as helpful ## Did it answer your question? - Mark it as a Solution 🙂
All code examples are provided as is. Responsibility for Code execution is solely your own.

On the page @Rasmus Hoffmann Birkelund gave (or any other API page), select "Code Snippets", "Curl" to get a copy and paste example.

image.png