1
1
mirror of https://github.com/pterodactyl/panel.git synced 2025-01-31 19:01:35 +01:00
0
API: Node Management
Dane Everitt edited this page 2016-09-05 16:18:27 -04:00

Node Management

GET /nodes[?page=]

Response Data

{
  "data": [
    {
      "id": 1,
      "public": 1,
      "name": "Local Node",
      "location": 1,
      "fqdn": "172.28.128.3",
      "scheme": "http",
      "memory": 1024,
      "memory_overallocate": 400,
      "disk": 1024000,
      "disk_overallocate": 10,
      "daemonListen": 8080,
      "daemonSFTP": 2022,
      "daemonBase": "/srv/daemon-data",
      "created_at": "2016-01-12 03:39:04",
      "updated_at": "2016-08-16 18:38:18"
    },
    {
      "id": 4,
      "public": 1,
      "name": "Wuzzle",
      "location": 1,
      "fqdn": "wuzzle.com",
      "scheme": "https",
      "memory": 10240,
      "memory_overallocate": 25,
      "disk": 204800,
      "disk_overallocate": null,
      "daemonListen": 8080,
      "daemonSFTP": 2022,
      "daemonBase": "/srv/daemon-data",
      "created_at": "2016-01-16 04:48:34",
      "updated_at": "2016-01-16 04:48:34"
    }
  ],
  "meta": {
    "pagination": {
      "total": 2,
      "count": 2,
      "per_page": 50,
      "current_page": 1,
      "total_pages": 1,
      "links": []
    }
  }
}

GET /nodes/:id[?fields=]

Response Data

{
  "node": {
    "id": 1,
    "public": 1,
    "name": "Local Node",
    "location": 1,
    "fqdn": "172.28.128.3",
    "scheme": "http",
    "memory": 1024,
    "memory_overallocate": 400,
    "disk": 1024000,
    "disk_overallocate": 10,
    "daemonListen": 8080,
    "daemonSFTP": 2022,
    "daemonBase": "/srv/daemon-data",
    "created_at": "2016-01-12 03:39:04",
    "updated_at": "2016-08-16 18:38:18"
  },
  "allocations": {
    "assigned": [
      {
        "id": 13,
        "node": 1,
        "ip": "172.28.128.3",
        "ip_alias": "172.28.128.3",
        "port": 25565,
        "assigned_to": 2,
        "created_at": "2016-01-12 03:40:37",
        "updated_at": "2016-01-12 03:53:22"
      }
    ],
    "unassigned": [
      {
        "id": 18,
        "node": 1,
        "ip": "172.28.128.3",
        "ip_alias": "172.28.128.3",
        "port": 25570,
        "assigned_to": null,
        "created_at": "2016-02-14 19:41:10",
        "updated_at": "2016-02-14 19:41:10"
      }
    ]
  }
}

GET /nodes/allocations

Returns a listing of all allocations for a node including their availability or assignment.

Responses

HTTP/200 — successful.

{
  "data": [
    {
      "id": 13,
      "node": 1,
      "ip": "172.28.128.3",
      "ip_alias": "172.28.128.3",
      "port": 25565,
      "assigned_to": 2
    },
    {
      "id": 14,
      "node": 1,
      "ip": "172.28.128.3",
      "ip_alias": "172.28.128.3",
      "port": 25566,
      "assigned_to": 2
    },
    {
      "id": 15,
      "node": 1,
      "ip": "172.28.128.3",
      "ip_alias": "gre.ptdl.io",
      "port": 25567,
      "assigned_to": null
    }
  ]
}

HTTP/404 — returned when the requested ID could not be found on the system.

POST /nodes

Creates a new node on the system.

Request Data

{
  "name": "Wuzzle",
  "location": 1,
  "public": 1,
  "fqdn": "wuzzle.com",
  "scheme": "https",
  "memory": 10240,
  "memory_overallocate": 25,
  "disk": 204800,
  "disk_overallocate": -1,
  "daemonBase": "/srv/daemon-data",
  "daemonListen": 8080,
  "daemonSFTP": 2022
}

Responses

HTTP/201 — returned when the node is created. Returns a Location header with a link to the new resource.

HTTP/422 — returned when there is an error with validating the data or the data sent wasn't able to be used (FQDN in use, etc.).

HTTP/503 — returned where there is an error that occurs while attempting to add the node that is unrelated to input data.

DELETE /nodes/:id

Deletes a node from the system. Only possible to do if there are no active servers assigned to the node.

Responses

HTTP/204 — returned when the node is successfully deleted.

HTTP/404 — returned when the requested ID could not be found on the system.

HTTP/422 — returned when there was a processing error that can be fixed by the user (usually because an active server is assigned to it).

HTTP/503 — returned where there is an error that occurs while attempting to delete the node that is not caused by a user action.