: Update a Virtual Router (REST API)
Focus
Focus

Update a Virtual Router (REST API)

Table of Contents

Update a Virtual Router (REST API)

REST API requests for a virtual router
A virtual router allows the firewall to route traffic from one network to another through its Layer 3 interfaces or static routes. Each Layer 3 interface, loopback interface, and VLAN interface defined on the firewall must be associated with a virtual router. Each interface can belong to only one virtual router.
The following steps show how to add an existing Ethernet interface to the predefined virtual router,
default
.
  1. Retrieve the existing virtual router named default.
    Before you update an existing virtual router by adding a new interface, you should retrieve the virtual router to identify interfaces that are already assigned to that virtual router.
    curl -X GET 'https://<firewall>/restapi/v11.0/Network/VirtualRouters' --header 'X-PAN-KEY: <api-key>’
    A successful response returns a list of existing virtual routers and includes detailed information for each one. The response object for this request is large, so the example response below shows a partial response object. You can see the list of existing interfaces, which will be necessary to include as request body parameters if you are updating the interface list in the virtual router. If the router were to include other configuration items such as protocol information or routes, you would need to include these in the update as well.
    { "@status": "success", "@code": "19", "result": { "@count": "1", "entry": [ { "@name": "default", "@location": "panorama-pushed", "interface": { "member": [ "ethernet1/4" ], "routing-table": {}, "protocol": {}, "admin-dists": {}, "ecmp": {} } } ] } }
  2. Update the existing virtual router named
    default
    .
    Update the virtual router
    default
    with a new L3 Ethernet interface,
    ethernet1/3
    , through a PUT request. Include all information that currently exist as well as any new information in the default Virtual Router in your PUT request.
    curl --location --request PUT 'https://<firewall>/restapi/v11.0/Network/VirtualRouters?name=default' --header 'X-PAN-Key:<api-key> --data '{ "entry": { "@name": "default", "interface": { "member": [ "ethernet1/3", "ethernet1/4" ] } } }'

Recommended For You