Skip to main content

Server API

POST /server

Description

This API endpoint retrieves detailed information about a specific server based on the provided server ID.

Request Body

The request uses GraphQL to perform the server query, requiring the server ID as a variable.

Query:

query server ($id: Int!) {
server (id: $id) {
id
hostName
publicIp
type
privateIp
city
country
continent
secret
ports
sshUsername
sshKey
killCommand
rootCommand
description
hero
spot
zeus
bridgeIp
bridgeCountry
}
}

GraphQL Variables:

{
"id": 0
}

Example Request:

curl --location '' \
--header 'Content-Type: application/json' \
--data '{"query":"query server ($id: Int!) {\n server (id: $id) {\n id\n hostName\n publicIp\n type\n privateIp\n city\n country\n continent\n secret\n ports\n sshUsername\n sshKey\n killCommand\n rootCommand\n description\n hero\n spot\n zeus\n bridgeIp\n bridgeCountry\n }\n}","variables":{"id":0}}'

Response:

  • Success (200 OK):

    • The response includes detailed information about the specified server.
    {
    "data": {
    "server": {
    "id": 0,
    "hostName": "server-01",
    "publicIp": "203.0.113.1",
    "type": "VPS",
    "privateIp": "10.0.0.1",
    "city": "New York",
    "country": "USA",
    "continent": "North America",
    "secret": "xyz123",
    "ports": "22, 80, 443",
    "sshUsername": "admin",
    "sshKey": "ssh-rsa AAAAB3...xyz",
    "killCommand": "shutdown -h now",
    "rootCommand": "sudo su",
    "description": "Primary server for application",
    "hero": false,
    "spot": false,
    "zeus": true,
    "bridgeIp": "192.168.1.1",
    "bridgeCountry": "USA"
    }
    }
    }
  • Error (4XX/5XX):

    • If there is an issue retrieving the server information, such as an invalid ID or server error, the response will include an error message and status code.

Note:

Ensure that the server ID provided in the query variables is valid and that the GraphQL server is properly configured to handle the server query for accurate results.