LibreNMS API: Device-Specific Endpoint "port_id" is Missing

When using the LibreNMS API to retrieve information about specific device ports, there seems to be an inconsistency in the returned data. The device-specific API does not return the port_id attribute for ports, while the general ports API does.

Issue Details:

  1. Device Specific API:

    • Endpoint: /api/v0/devices/DEVICE_ID/ports
    • Sample Output:
      {
          "status": "ok",
          "ports": [
              {
                  "ifName": "InLoopBack0"
              },
              ...
          ]
      }
      
    • The above output does not include the port_id attribute for the ports.
  2. General Ports API:

    • Endpoint: /api/v0/ports
    • Sample Output:
      {
          "status": "ok",
          "ports": [
              {
                  "port_id": 1,
                  "ifName": "InLoopBack0"
              },
              ...
          ]
      }
      
    • This output includes the port_id attribute, which is missing from the device-specific API.

You can specify the columns you want returned in the API results for /api/v0/devices/DEVICE_ID/ports?columns=port_id,ifName

It’s in the docs

Thanks It helps.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.