API Tutorial - seDirector/App GitHub Wiki

[!NOTE] The Pro edition of seDirector is required to use the API.

This guide will walk you through various endpoints and how to use them.

Coming Soon

We're working on a web panel that can be integrated with seDirector's API. More to come in the future!

Prerequisites

  • API Key:
    • You'll need an API key for authentication for all endpoint requests.
  • Base URL:
    • The base URL for all requests is http://[IP]:10447/api/servers.

Understanding Server Data

Here's a basic structure of a server's data:

{
  "id": 0,
  "name": "Your GameServer Name",
  "status": "Running",
  "uptime": "00.17:34:26",
  "ipAddress": "127.0.0.1",
  "port": "27015",
  "currentNumberOfPlayers": "49/64",
  "currentMap": "de_dust2",
  "game": "Counter-Strike: Source"
}

API Endpoints

1. Retrieve All Servers

  • Endpoint: http://[IP]:10447/api/servers?apikey=[YourApiKey]
  • Expected Response:
    • A list of all servers and their details.

2. Start a Server

  • Endpoint: http://[IP]:10447/api/servers/start/[ServerID]?apikey=[YourApiKey]
  • Parameters:
    • Replace [ServerID] with the ID of the server you intend to start.
  • Expected Response:
    • Confirmation that the server has started.

3. Stop a Server

  • Endpoint: http://[IP]:10447/api/servers/stop/[ServerID]?apikey=[YourApiKey]
  • Parameters:
    • Replace [ServerID] with the ID of the server you intend to stop.
  • Expected Response:
    • Confirmation that the server has stopped.

4. Restart a Server

  • Endpoint: http://[IP]:10447/api/servers/restart/[ServerID]?apikey=[YourApiKey]
  • Parameters:
    • Replace [ServerID] with the ID of the server you intend to restart.
  • Expected Response:
    • Confirmation that the server has restarted.

5. Start All Servers

  • Endpoint: http://[IP]:10447/api/servers/start/all?apikey=[YourApiKey]
  • Expected Response:
    • Confirmation that all servers have started.

6. Stop All Servers

  • Endpoint: http://[IP]:10447/api/servers/stop/all?apikey=[YourApiKey]
  • Expected Response:
    • Confirmation that all servers have stopped.

JSON Visualization Extensions

To view JSON data in a more readable format in your browser, consider using these extensions:

Conclusion

With this tutorial, you should have a clear understanding of how to manage game servers using the seDirector Game Server Management API. Always ensure your API key remains confidential and isn't exposed to the public.