Jails

Resources related to FreeBSD Jails.

Jails

The Jails resource represents FreeBSD Jails.

List resource

GET /api/v1.0/jails/jails/

Returns a list of all jails.

Example request:

GET /api/v1.0/jails/jails/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

[
  {
    "id": 1,
    "jail_alias_bridge_ipv4": null,
    "jail_alias_bridge_ipv6": null,
    "jail_alias_ipv4": null,
    "jail_alias_ipv6": null,
    "jail_autostart": True,
    "jail_bridge_ipv4": null,
    "jail_bridge_ipv4_netmask": "",
    "jail_bridge_ipv6": null,
    "jail_bridge_ipv6_prefix": "",
    "jail_defaultrouter_ipv4": null,
    "jail_defaultrouter_ipv6": null,
    "jail_flags": "allow.raw_sockets=true",
    "jail_host": "transmission_1",
    "jail_ipv4": "192.168.3.2",
    "jail_ipv4_netmask": "24",
    "jail_ipv6": null,
    "jail_ipv6_prefix": "",
    "jail_mac": "02:c3:79:00:08:0b",
    "jail_nat": false,
    "jail_status": "Running",
    "jail_type": "pluginjail",
    "jail_vnet": true
  }
]
Query Parameters:
 
  • offset – offset number. default is 0
  • limit – limit number. default is 30
Response Headers:
 
  • Content-Type – content type of the response
Status Codes:
  • 200 – no error

Create resource

POST /api/v1.0/jails/jails/

Creates a new jail and returns the new jail object.

Example request:

POST /api/v1.0/jails/jails/ HTTP/1.1
Content-Type: application/json

  {
    "jail_host": "test",
    "jail_type": "pluginjail"
  }

Example response:

HTTP/1.1 201 Created
Vary: Accept
Content-Type: application/json

  {
    "id": 1,
    "jail_alias_bridge_ipv4": null,
    "jail_alias_bridge_ipv6": null,
    "jail_alias_ipv4": null,
    "jail_alias_ipv6": null,
    "jail_autostart": true,
    "jail_bridge_ipv4": null,
    "jail_bridge_ipv4_netmask": "",
    "jail_bridge_ipv6": null,
    "jail_bridge_ipv6_prefix": "",
    "jail_defaultrouter_ipv4": null,
    "jail_defaultrouter_ipv6": null,
    "jail_flags": "allow.raw_sockets=true",
    "jail_host": "transmission_1",
    "jail_ipv4": "192.168.3.2",
    "jail_ipv4_netmask": "24",
    "jail_ipv6": null,
    "jail_ipv6_prefix": "",
    "jail_mac": "02:c3:79:00:08:0b",
    "jail_nat": false,
    "jail_status": "Running",
    "jail_type": "pluginjail",
    "jail_vnet": true
  }
Json Parameters:
 
  • jail_alias_bridge_ipv4 (string) – ipv4 bridge address
  • jail_alias_bridge_ipv6 (string) – ipv6 bridge address
  • jail_alias_ipv4 (string) – ipv4 address aliases
  • jail_alias_ipv6 (string) – ipv6 address aliases
  • jail_autostart (boolean) – automatically start jail at boot
  • jail_bridge_ipv4 (string) – ipv4 bridge
  • jail_bridge_ipv4_netmask (string) – ipv4 netmask
  • jail_bridge_ipv6 (string) – ipv6 bridge
  • jail_bridge_ipv6_prefix (string) – ipv6 prefix
  • jail_defaultrouter_ipv4 (string) – ipv4 default route
  • jail_defaultrouter_ipv6 (string) – ipv6 default route
  • jail_flags (string) – sysctl jail flags
  • jail_host (string) – hostname of the jail
  • jail_ipv4 (string) – ipv4 address of the jail
  • jail_ipv4_netmask (string) – ipv4 netmask (8, 16, 24, 32)
  • jail_ipv6 (string) – ipv6 address of the jail
  • jail_ipv6_prefix (string) – ipv6 prefix
  • jail_mac (string) – mac address for the jail interface
  • jail_nat (boolean) – enable NAT for the jail
  • jail_status (string) – current status of the jail
  • jail_type (string) – type of the jail (pluginjail, standard, portjail, ...)
  • jail_vnet (boolean) – enable VIMAGE for the jail
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 201 – no error

Start jail

POST /api/v1.0/jails/jails/(int: id)/start/

Starts a jail.

Example request:

POST /api/v1.0/jails/jails/1/start/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 202 Accepted
Vary: Accept
Content-Type: application/json

  Jail started.
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 202 – no error

Stop jail

POST /api/v1.0/jails/jails/(int: id)/stop/

Stops a jail.

Example request:

POST /api/v1.0/jails/jails/1/stop/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 202 Accepted
Vary: Accept
Content-Type: application/json

  Jail stopped.
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 202 – no error

Delete resource

DELETE /api/v1.0/jails/jails/(int: id)/

Delete jail id.

Example request:

DELETE /api/v1.0/jails/jails/2/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 204 No Response
Vary: Accept
Content-Type: application/json
Status Codes:
  • 204 – no error

Table Of Contents

Previous topic

Account

Next topic

Network

This Page