cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

APIv1 Uplinks

Highlighted
Getting noticed

APIv1 Uplinks

Do we really have to retrieve all uplinks for every firewall in the organization? Or is there a hidden way to filter to a single MX. 

 

What I had:

 

/networks/$net_id/devices/$mx_serial/uplink

[
    {
        "interface": "WAN 1",
        "status": "Active",
        "ip": "x.x.x.x",
        "gateway": "x.x.x.x",
        "publicIp": "x.x.x.x",
        "dns": "208.67.222.222, 208.67.220.220",
        "usingStaticIp": true
    },
    {
        "interface": "WAN 2",
        "status": "Ready",
        "ip": "y.y.y.y",
        "gateway": "y.y.y.y",
        "publicIp": "y.y.y.y",
        "dns": "208.67.222.222, 208.67.220.220",
        "usingStaticIp": true
    }
]

 

What I have now:

 

/organizations/$org_id/appliance/uplink/statuses

    {
        "networkId": "12345",
        "serial": "a-b-c",
        "lastReportedAt": "2020-08-12T21:57:23Z",
        "uplinks": [
            {
                "interface": "wan1",
                "status": "active",
                "ip": "x.x.x.x",
                "gateway": "x.x.x.x",
                "publicIp": "x.x.x.x",
                "primaryDns": "8.8.8.8",
                "secondaryDns": "8.8.4.4",
                "ipAssignedBy": "static"
            },
            {
                "interface": "wan2",
                "status": "not connected",
                "ip": null,
                "gateway": null,
                "publicIp": null,
                "primaryDns": null,
                "secondaryDns": null,
                "ipAssignedBy": null
            }
        ]
    }

 

6 REPLIES 6
Highlighted
Meraki Employee

Re: APIv1 Uplinks

Hi @boomi ! If you already know the serial # for the MX you want to check, then you can filter to a single MX after you've run the API call.

 

E.g. in Python, using the SDK:

mx_selected_serial = 'ACTU_ALSE_RIAL'

mx_statuses = dashboard.appliance.getOrganizationApplianceUplinkStatuses( organization_id, total_pages='all' )

for mx_status in mx_statuses:
    if mx_status['serial'] == mx_selected_serial:
        selected_mx_status = mx_status

print(selected_mx_status['uplinks'])

 

This approach also substantially cuts down the number of API calls you would need to make, so if you are working in an org with a ton of appliances, you are less likely to hit the rate limit. Check out the template for the Python library here: https://developer.cisco.com/meraki/api-v1/#!get-organization-appliance-uplink-statuses

Highlighted
Getting noticed

Re: APIv1 Uplinks

Thanks for the example John, however I'm not able to avoid making a call for every MX I need to check. Granted the amount of 'waste' we're talking about is trivial, there should still be a filter available on this call. Caching is also not an option.

 

I understand v1 was just released, so I'm curious if the intent is to stick with bulk requests like this, or if targeted/filtered calls will be introduced down the road.

 

 

Highlighted
Meraki Employee

Re: APIv1 Uplinks

I might have misunderstood -- calling /organizations/$org_id/appliance/uplink/statuses is a single API call; the rest would be done client-side. What's happening that makes you need to make a call for every MX individually?

Highlighted
Getting noticed

Re: APIv1 Uplinks

I'm providing network monitoring with the API, and each firewall is a node that has its own 'instances' that are polled regularly. I can't make a single call and then distribute that data to each node.

Highlighted
Meraki Employee

Re: APIv1 Uplinks

Hm... Could each node pull all the data and discard what it doesn't need? Is this a fully custom app or built into an existing framework/product that has limitations you're working around?

Highlighted
Getting noticed

Re: APIv1 Uplinks

Sure can, and I do, it's just that I would prefer if I had a more direct way to make this query, like the v0 API, which allows a request for a specific MX.

 

Now I have to account not only for searching the data, but presumably pagination as well for sufficiently large organizations.

 

 

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.