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?
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 may be wrong, but what you wrote is identical to mine. Is it working for you that request?
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.
Yeah I opened a case, thanks for the help!
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/
On the page @rhbirkelund gave (or any other API page), select "Code Snippets", "Curl" to get a copy and paste example.