| Verb | URI | Description | |||
| POST | /tenants/tenant-id/networks/
network-id/ports |
Creates a port on the
network specified in the request URI,
identified by
network-id. |
|||
Normal Response Code(s): 200
Error Response Code(s): BadRequest (400), Unauthorized (401), Forbidden (403), NetworkNotFound (420), RequestedStateInvalid (431)
This operation creates a port on a Quantum network based on the information provided in the request body. Quantum validates the request, and dispatches the request to the plugin, which creates the port and attaches it to the appropriate network.
This operation could not be implemented for some plugins as the number of ports available might be fixed when the network is created.
If the validation phase fails, the port object is not created at
all, and a BadRequest error is
returned to the caller.
The operation returns a port with an identifier, and set its
administrative state set to DOWN,
unless a state has been explicitly specified in
the request body.
![]() | Note |
|---|---|
This operation does not guarantee that the port has been actually created when the calls returns, as the plugin might still be performing the necessary operations on the network infrastructure. However, the port entity can be immediately used for API operations. |
The request body is not required for this operation, but it can
optionally contain the administrative state for
the port being created, which can be either
DOWN or ACTIVE. The
administrative state should be encapsulated into a
Port object within the request body, as shown in
the example below.
Example 4.23. Create Port Request/Response (XML)
Request:
POST /tenants/33/networks/158233b0-ca9a-40b4-8614-54a4a99d47d1/ports.xml
<port
state="ACTIVE"/>
Response:
<port
id="98017ddc-efc8-4c25-a915-774b2a633855"/>
Example 4.24. Create Port Request/Response (JSON)
Request:
POST /tenants/33/networks/158233b0-ca9a-40b4-8614-54a4a99d47d1/ports.json
{
"port":
{
"state": "ACTIVE"
}
}
Response:
{
"port":
{
"id": "98017ddc-efc8-4c25-a915-774b2a633855"
}
}

![[Note]](../common/images/admon/note.png)
