Skip to content

Network service API reference

See https://docs.openstack.org/api-ref/network/.

In these methods, {network_id}, {subnet_id}, {port_id}, {router_id}, and {floatingip_id} are placeholders that should be replaced with the actual IDs of the respective resources. These methods allow you to manage networks, subnets, ports, routers, and floating IPs in the Network service.

List networks

Bash
GET /v2.0/networks

Show network details

Bash
GET /v2.0/networks/{network_id}

Create a network

Bash
POST /v2.0/networks
  • Request body
JSON
{
 "network": {
   "name": "network_name",
   "admin_state_up": true
 }
}

Update a network

Bash
PUT /v2.0/networks/{network_id}
  • Request body
    JSON
    {
     "network": {
       "name": "new_network_name"
     }
    }
    

Delete a network

Bash
DELETE /v2.0/networks/{network_id}

List subnets

Bash
GET /v2.0/subnets

Show subnet details

Bash
GET /v2.0/subnets/{subnet_id}

Create a subnet

Bash
POST /v2.0/subnets
  • Request body
    JSON
    {
     "subnet": {
       "network_id": "network_id",
       "ip_version": 4,
       "cidr": "192.168.1.0/24"
     }
    }
    

Update a subnet

Bash
PUT /v2.0/subnets/{subnet_id}
  • Request body
    JSON
    {
     "subnet": {
       "name": "new_subnet_name"
     }
    }
    

Delete a subnet

Bash
DELETE /v2.0/subnets/{subnet_id}

List ports

Bash
GET /v2.0/ports

Show port details

Bash
GET /v2.0/ports/{port_id}

Create a port

Bash
`POST /v2.0/ports
  • Request body
    JSON
    {
      "port": {
        "network_id": "network_id",
        "admin_state_up": true
      }
    }
    

Update a port

Bash
PUT /v2.0/ports/{port_id}
  • Request body
    JSON
    {
      "port": {
        "name": "new_port_name"
      }
    }
    

Delete a port

Bash
    - `DELETE /v2.0/ports/{port_id}`

### List routers
```bash
GET /v2.0/routers

Show router details

Bash
GET /v2.0/routers/{router_id}

Create a router

Bash
POST /v2.0/routers
  • Request body
    JSON
    {
      "router": {
      "name": "router_name",
      "admin_state_up": true
      }
    }
    

Update a router

Bash
PUT /v2.0/routers/{router_id}
  • Request body
    JSON
    {
      "router": {
      "name": "new_router_name"
      }
    }
    

Delete a router

Bash
DELETE /v2.0/routers/{router_id}

Add interface to router

Bash
PUT /v2.0/routers/{router_id}/add_router_interface
  • Request body
    JSON
    {
      "subnet_id": "subnet_id"
    }
    

Remove interface from router

Bash
PUT /v2.0/routers/{router_id}/remove_router_interface
  • Request body
    JSON
    {
      "subnet_id": "subnet_id"
    }
    

List floating IPs

Bash
GET /v2.0/floatingips

Show floating IP details

Bash
GET /v2.0/floatingips/{floatingip_id}

Create a floating IP

Text Only
POST /v2.0/floatingips
  • Request body
    JSON
    {
      "floatingip": {
        "floating_network_id": "public_network_id"
      }
    }
    

Update a floating IP

Bash
PUT /v2.0/floatingips/{floatingip_id}
  • Request body
    JSON
    {
      "floatingip": {
        "port_id": "port_id"
      }
    }
    

Delete a floating IP

Text Only
DELETE /v2.0/floatingips/{floatingip_id}