Verb | URI | Description |
PUT | /subnets/subnet-id |
Updates the specified subnet. |
Normal Response Code: Ok (200)
Error Response Codes: Bad Request (400), Unauthorized (401), Forbidden (403), Not Found (404)
This operation updates the specified subnet.
Some attributes, such as IP version
(ip_version
), CIDR
(cidr
), and IP
allocation pools
(allocation_pools
)
cannot be updated. Attempting to update these
attributes results in a 400
Bad Request error.
This operation requires a request body.
This operation returns a response body.
![]() | Note |
---|---|
Update operations in OpenStack Networking adopt patch semantics. This implies that the Networking API v2.0 does not require you to send the whole resource to be updated, but just the attributes that you wish to update, as shown in the following example. |
Example 4.23. Update Subnet: JSON Request
PUT /v2.0/subnets/9436e561-47bf-436a-b1f1-fe23a926e031 Content-Type: application/json Accept: application/json
{ "subnet":{ "gateway_ip":"10.0.3.254", "name":"new_name" } }
Example 4.24. Update Subnet: JSON Response
status: 200 content-length: 381 content-type: application/json { "subnet": { "allocation_pools": [ { "end": "10.0.3.254", "start": "10.0.3.2" } ], "cidr": "10.0.3.0/24", "dns_nameservers": [], "enable_dhcp": true, "gateway_ip": "10.0.3.1", "host_routes": [], "id": "91e47a57-7508-46fe-afc9-fc454e8580e1", "ip_version": 4, "name": "sample_subnet", "network_id": "1a6f6006-9e0b-4f99-984c-96787ae66363", "tenant_id": "f667b69e4d6749749ef3bcba7251d9ce" } }