Different Network ID of MQTT message and API networks

MilosJovanovic
New here

Different Network ID of MQTT message and API networks

I'm an external developer for a client. Working on getting data from Meraki MR devices. I have a very basic understanding of Meraki dashboard and apis.

I successfully got data off of meraki api, and I'm triggering .../organizations/:organizationId/networks

to get available networks for the organization (having only one). I'm getting a network with ID L_.....

 

This is all good, but when I configured MQTT in Wireless->IoT Radio Settings, I'm receiving MQTT messages on topic

meraki/v1/mr/N_...../... and in the payload network id is N_......

 

As the app we're making needs the client to pick a network that we're going to listen MQTT messages for, how do I get that N_... network id via api? I'm only gettting L_...

If I call some other endpoints with networkId of N_... they still work and provide data, but I see no way to know the N_... network id before receiving some mqtt message.

 

Anything I'm missing? Do I need to somehow map the N_... network id to L_... network id in our part of software? If so - where in GUI can client procure this network id?

4 Replies 4
sungod
Head in the Cloud

The N_/L_ prefix depends on the network type, see this page:

 

https://developer.cisco.com/meraki/build/deep-links/

 

But if I look at the source of a Dashboard page showing, say, an MR device in a combined network, then search for Mkiconf.locale_id and Mkiconf.ng_id, these are the L_ and N_ identifiers respectively, it appears both can exist for the same network, which looks like what you are experiencing....

 

Example (actual values altered):

Mkiconf.locale_id = "602919401234567890";
Mkiconf.ng_id = "602919400987654321";

 

Why both? I have no idea!

 

I don't recall seeing an API call to get both, but I'd guess you could use the deep link capability explained on the link above to grab the JSON from a Dashboard page on the target network and get them that way.

 

PhilipDAth
Kind of a big deal
Kind of a big deal

This API call will return a list of all networks and their IDs.

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

 

That call returns the L_ combined network locale ID, not the individual N_ network IDs.

Ryan

If you found this post helpful, please give it Kudos. If my answer solves your problem please click Accept as Solution so others can benefit from it.
John_on_API
Meraki Employee
Meraki Employee

Hi @MilosJovanovic taking off my employee hat and speaking as a civilian, this sounds a bit like unintended behavior. You might want to check with support on this -- imho, MQTT should use the same network ID that dashboard API uses.

 

You might report this as "MQTT API doesn't use the network ID in topics" and point them to this thread.

 

In the meantime, I think you'll need to use the device serial number, and poll getOrganizationDevices (you can filter on productTypes[]=wireless, if you only care about MR), to find out what the network ID of a given MR is.

 

Putting the employee hat back on, this is a limitation on the MQTT side, and not a flaw with dashboard API.

Get notified when there are additional replies to this discussion.