Networks¶
These endpoints allow configuration of networks, used by Views.
Networks Endpoints¶
- GET /servers/{server_id}/networks¶
List all registered networks and views in a server
- Parameters:¶
server_id (string) – The id of the server to retrieve
Example request:
GET /servers/{server_id}/networks HTTP/1.1 Host: example.com- Status Codes:¶
200 OK –
An array of networks
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "networks": [ { "network": "string", "view": "string" } ] }default –
The input to the operation was not valid
Example response:
HTTP/1.1 default - Content-Type: application/json { "error": "string", "errors": [ "string" ] }
- GET /servers/{server_id}/networks/{ip}/{prefixlen}¶
Return the view associated to the given network
- Parameters:¶
server_id (string) – The id of the server to retrieve
ip (string) – The base address of the network
prefixlen (string) – The length of the network prefix
Example request:
GET /servers/{server_id}/networks/{ip}/{prefixlen} HTTP/1.1 Host: example.com- Status Codes:¶
200 OK –
A network
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "network": "string", "view": "string" }default –
The input to the operation was not valid
Example response:
HTTP/1.1 default - Content-Type: application/json { "error": "string", "errors": [ "string" ] }
- PUT /servers/{server_id}/networks/{ip}/{prefixlen}¶
Sets the view associated to the given network
- Parameters:¶
server_id (string) – The id of the server to retrieve
ip (string) – The base address of the network
prefixlen (string) – The length of the network prefix
Example request:
PUT /servers/{server_id}/networks/{ip}/{prefixlen} HTTP/1.1 Host: example.com Content-Type: application/json { "view": "string" }- Status Codes:¶
204 No Content – Returns 204 No Content on success.
default –
The input to the operation was not valid
Example response:
HTTP/1.1 default - Content-Type: application/json { "error": "string", "errors": [ "string" ] }
Examples¶
Listing all networks¶
GET /api/v1/servers/localhost/networks HTTP/1.1
X-API-Key: secret
Will yield a response similar to this (several headers omitted):
HTTP/1.1 200 OK
Content-Type: application/json
{"networks": [{"network":"192.168.0.0/16","view":"trusted"},{"network":"0.0.0.0/0","view":"untrusted"}]}
Listing the view of a given network¶
GET /api/v1/servers/localhost/networks/192.168.0.0/16 HTTP/1.1
X-API-Key: secret
Will yield a response similar to this (several headers omitted):
HTTP/1.1 200 OK
Content-Type: application/json
{"networks": [{"network":"192.168.0.0/16","view":"trusted"}]}
Setting up a network¶
PUT /api/v1/servers/localhost/networks/192.168.0.0/16 HTTP/1.1
X-API-Key: secret
Content-Type: application/json
{"view": "trusted"}
Will yield a response similar to this (several headers omitted):
HTTP/1.1 204 No Content