Request and response formats¶
The Networking API v2.0 supports JSON data serialization request and response formats only.
Request format¶
The Networking API v2.0 only accepts requests with the JSON data serialization format. The Content-Type
header is ignored.
Tenant and project attributes in requests¶
Starting with the Newton release of the Networking service, the Networking API accepts the project_id
attribute in addition to the tenant_id
attribute in requests. The tenant_id
attribute is accepted for backward compatibility. If both the project_id
and the tenant_id
attribute are provided in the same request, their values must be identical.
To determine whether a Networking API v2.0 endpoint supports the project_id
attribute in requests, check that the project-id
API extension is enabled (seeExtensions).
Response format¶
The Networking API v2.0 always responds with the JSON data serialization format. The Accept
header is ignored.
-
Query extension
-
A
.json
extension can be added to the request URI. For example, the.json
extension in the following requests are equivalent:GET
publicURL/networksGET
publicURL/networks.json
Tenant and project attributes in responses¶
Starting with the Newton release of the Networking service, the Networking API returns a project_id
attribute in responses, while still returning a tenant_id
attribute for backward compatibility. The values will always be identical.
To determine whether a Networking API v2.0 endpoint returns the project_id
attribute in responses, check that the project-id
API extension is enabled (seeExtensions).
Filtering and column selection¶
The Networking API v2.0 supports filtering based on all top level attributes of a resource. Filters are applicable to all list requests.
For example, the following request returns all networks named foobar
:
GET /v2.0/networks?name=foobar
When you specify multiple filters using different fields, the Networking API v2.0 returns only objects that meet all filtering criteria. The operation applies an AND condition among different filter fields.
OpenStack Networking offers an OR mechanism for filters by repeating the field with the different OR criteria. For example, to find all networks named foobar
ORbizbaz
:
GET /v2.0/networks?name=foobar&name=bizbaz
ORs and ANDs can be combined. For example, if you want all networks with admin_state_up=True and shared=True and named foobar
or bizbaz
:
GET /v2.0/networks?name=foobar&name=bizbaz&admin_state_up=True&shared=True
Note¶
By default, OpenStack Networking returns all attributes for any show or list call. The Networking API v2.0 has a mechanism to limit the set of attributes returned. For example, return id
.
You can use the fields
query parameter to control the attributes returned from the Networking API v2.0.
For example, the following request returns only id
and name
for each network:
GET /v2.0/networks.json?fields=id&fields=name