Create interface
Method | URI | Description |
---|---|---|
POST | /v2/{tenant_id}/servers/{server_id}/os-interface | Creates and uses a port interface to attach the port to a server instance. |
Normal response codes: 200
Request
This table shows the URI parameters for the create interface request:
Name | Type | Description |
---|---|---|
{tenant_id} | String | Project ID |
{server_id} | UUID | The UUID for the server of interest to you. |
This table shows the body parameters for the create interface request:
Name | Type | Description |
---|---|---|
interfaceAttachment | String | Specify the interfaceAttachment action in the request body. |
port_id | UUID | The ID of the port for which you want to create an interface. The net_id and port_id parameters are mutually exclusive. |
net_id | UUID | The ID of the network for which you want to create a port interface. The net_id and port_id parameters are mutually exclusive. |
fixed_ips | array | Fixed IP addresses. If you request a specific fixed IP address without a net_id, the request returns a Bad Request (400) response code. |
Example. Create interface: JSON request
Create interface with port_id.
{
"interfaceAttachment": {
"port_id": "ce531f90-199f-48c0-816c-13e38010b442"
}
}
Create interface with net_id and fixed_ips.
{
"interfaceAttachment": {
"fixed_ips": [
{
"ip_address": "192.168.1.3"
}
],
"net_id": "3cb9bc59-5699-4588-a4b1-b87f96708bc6"
}
}
Response
Example. Create interface: JSON response
{
"interfaceAttachment": {
"fixed_ips": [
{
"ip_address": "192.168.1.1",
"subnet_id": "f8a6e8f8-c2ec-497c-9f23-da9616de54ef"
}
],
"mac_addr": "fa:16:3e:4c:2c:30",
"net_id": "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
"port_id": "ce531f90-199f-48c0-816c-13e38010b442",
"port_state": "ACTIVE"
}
}