Examples: GET method

Instructions and examples in this document use an IP address that is reserved for documentation, 192.0.2.5, as an example of the IP address for the switch. To access your switch, you must use the IP address or hostname of that switch.

  • Get the list of all VLANS:

    GET "https://192.0.2.5/rest/v1/system/bridge/vlans"
  • Expand the list of URIs in the vlans collection by one level, which replaces the URI for the VLAN with the JSON data for that VLAN.

    GET "https://192.0.2.5/rest/v1/system/bridge/vlans?depth=1"
  • Use the count parameter to get the total number of VLANs:

    GET "https://192.0.2.5/rest/v1/system/bridge/vlans?count"
  • Use the count parameter with the filter parameter to get the total number of interfaces in a down administrative state:

    GET "https://192.0.2.5/rest/v1/system/interfaces?count=true&filter=admin_state:down"
  • Use the filter parameter with the value type:static to get a list of only the static VLANs:

    GET "https://192.0.2.5/rest/v1/system/bridge/vlans?filter=type:static"
  • Use the filter parameter to get the BGP routes that have 1.1.1.1 as a peer:

    GET "https://192.0.2.5/rest/v1/system/vrfs/default/bgp_routes?filter=peer:1.1.1.1"
  • Use the attributes parameter to get all ports but show only the attributes name and ipv4_address:

    GET "https://192.0.2.5/rest/v1/system/ports?attributes=name,ipv4_adress"
  • Use the wildcard character to get a list of routes for all VRFs.

    GET "https://192.0.2.5/rest/v1/system/vrfs/*/routes"
  • Use the selector parameter to get all the configuration attributes of VLAN 100:

    GET "https://192.0.2.5/rest/v1/system/bridge/vlans/100?selector=configuration"
  • Use the selector parameter to get all the system attributes that are in the categories configuration and status:

    GET "https://192.0.2.5/rest/v1/system?selector=category,status"