API: network traffic - need help

vdurgad
Meraki Employee
Meraki Employee

API: network traffic - need help

The API GET/networks/{networkId}/traffic?timespan=7500 returns an empty array. I have a network with some clients and have traffic analysis and hostname visibility enabled a couple of days back. I see some data on the Traffic Analytics page on the UI but this API doesn't return anything. I tried with multiple timestamp values but no use. Any help in this matter would be appreciated. 

5 Replies 5
jdsilva
Kind of a big deal

Can you provide the complete code you're using? With API keys and Network ID's scrubbed of course. 

Nash
Kind of a big deal

As @jdsilva says, we really need to see your sanitized code.

 

Sometimes things like this are due to typos that you can't see yourself or something else missing. I recently wasted 45 minutes on something because I didn't realize I was using requests.put instead of requests.post, for instance. 🙂

vdurgad
Meraki Employee
Meraki Employee

Thanks for the quick response 🙂 

I am trying this in postman. This is exact URL with method GET https://api.meraki.com/api/v0/networks/{networkID}/traffic?timespan=7200.

 

Headers: 

X-Cisco-Meraki-API-Key : {key}

Content-Type : "application/json".

 

and response.

 

[]

Nash
Kind of a big deal

Okay, when I test that one out, I get back:

 

{
    "errors": [
        "Traffic Analysis with Hostname Visibility must be enabled on this network to retrieve traffic data."
    ]
}
 
Because, well, hostname visibility isn't... enabled... on my test network. 🙂

So you're not getting that, you're getting empty? What's the return code you see? 
 
200status.png
I tested it using the Launchpad API key and I get returns that way, and the above 200 OK status.
 
What happens when you use the Launchpad API key?
vdurgad
Meraki Employee
Meraki Employee

Yes, the status is 200, I enabled the traffic analysis and hostname visibility. So was wondering if there is a min threshold data needed for the API to show some response? because I see some data in the UI (unless the corresponding APIs are different)

 

Screen Shot 2020-02-20 at 5.08.22 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.
Labels