getNetworkEvents working example with curl

Solved
Prodrick
Building a reputation

getNetworkEvents working example with curl

I've been trying to use this endpoint but haven't had any success.  I wonder if someone might share a working example executed with curl.


1 Accepted Solution

On your Authorization Bearer, are you perhaps missing an apostrophe? Or is that just a result of the anonymisation?

LinkedIn ::: https://blog.rhbirkelund.dk/

Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂

All code examples are provided as is. Responsibility for Code execution lies solely your own.

View solution in original post

11 Replies 11
alemabrahao
Kind of a big deal
Kind of a big deal

Hi,

 

Here is an example:

 

curl -L -H 'X-Cisco-Meraki-API-Key: <Your-API-Key>' -X GET -H 'Content-Type: application/json' 'https://api.meraki.com/api/v1/networks/<Your-Network-ID>/events'

I am not a Cisco Meraki 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.
alemabrahao
Kind of a big deal
Kind of a big deal

In the API documentation there is also an example of curl code.

 

Get Network Events - Meraki Dashboard API v1 - Cisco Meraki Developer Hub

I am not a Cisco Meraki 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.
Prodrick
Building a reputation

I literally copied the curl command from this page, and followed the same process as I usually to to test endpoints.  I copy the curl example, swap-out my API key and put single quotes around the call.  I'm used to the API providing a useful error message, but in this case I get nothing.

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

The correct command.

 

curl -L -H 'X-Cisco-Meraki-API-Key: <Your-API-Key>' -X GET -H 'Content-Type: application/json' 'https://api.meraki.com/api/v1/networks/<Your-Network-ID>/events?productType=wireless'

 

You have to add the productType

I am not a Cisco Meraki 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.
rhbirkelund
Kind of a big deal
Kind of a big deal

 

Copied directly from meraki.io - https://developer.cisco.com/meraki/api-v1/get-network-events/

 

Last login: Thu Mar  7 13:35:54 on ttys007
RHB@wopr ~ % curl -L --request GET \
--url 'https://api.meraki.com/api/v1/networks/xxxx/events?productType=appliance' \
--header 'Authorization: Bearer xxxx' \
--header 'Accept: application/json'

{"message":null,"pageStartAt":"2024-03-08T18:02:41.102375Z","pageEndAt":"2024-03-08T19:08:17.455765Z","events":[], ...}

 

 

LinkedIn ::: https://blog.rhbirkelund.dk/

Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂

All code examples are provided as is. Responsibility for Code execution lies solely your own.
Prodrick
Building a reputation

Thanks so much.  When I execute this for a network that I know has an appliance, this is what I get:

Last login: Fri Mar  8 13:50:23 on ttys000

patrick.rouse@RMT-PROUSE ~ % curl -L --request GET \

--url 'https://api.meraki.com/api/v1/networks/L_1234567890/events?productType=appliance' \

--header 'Authorization: Bearer 1234567890\

--header 'Accept: application/json'

patrick.rouse@RMT-PROUSE ~ %

Have you tried the code that I sent to you?

I am not a Cisco Meraki 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.

On your Authorization Bearer, are you perhaps missing an apostrophe? Or is that just a result of the anonymisation?

LinkedIn ::: https://blog.rhbirkelund.dk/

Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂

All code examples are provided as is. Responsibility for Code execution lies solely your own.
Prodrick
Building a reputation

I think the post stripped that out.  Here's a screenshot.  No error message, just a null response. Could there be something a customer has to enable in the Dashboard that I could verify via the API?

Screenshot 2024-03-08 at 3.01.04 PM.png

I really can't say what's going on. Perhaps try adding "&perPage=1000" after "appliance" on the URL?

LinkedIn ::: https://blog.rhbirkelund.dk/

Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂

All code examples are provided as is. Responsibility for Code execution lies solely your own.
Prodrick
Building a reputation

Ok, I got this working, but I don't know why the following command did not give me an incorrect API key response when I missed a character.

Thanks to all who helped.

Screenshot 2024-03-08 at 3.48.08 PM.png

Get notified when there are additional replies to this discussion.
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.