-
Notifications
You must be signed in to change notification settings - Fork 76
Developer Guides ‐ CRCON API
🧭 You are here : Wiki home / Developer Guides / CRCON API
There is an API for CRCON available at :
-
http://(your VPS IP):8010/api/
(sending API commands to the CRCON for the first -or only- game server) -
http://(your VPS IP):8011/api/
(for the second game server) - ...
As of CRCON v11.1.0, there is 278 endpoints available.
You'll find the complete list of available endpoints here : http://(your VPS IP):8010/api/get_api_documentation
For each entry, you'll get :
- endpoint name
- required arguments and types
- API command return type
- description
-
auto_settings_capable
indicator - allowed HTTP request method (either POST or GET)
ie, for add_map_to_rotation
:
{
"endpoint": "add_map_to_rotation",
"arguments": {
"map_name": {
"default": null,
"annotation": "<class 'str'>"
},
"after_map_name": {
"default": "None",
"annotation": "str | None"
},
"after_map_name_number": {
"default": "None",
"annotation": "int | None"
}
},
"return_type": "<class 'str'>",
"doc_string": null,
"auto_settings_capable": true,
"allowed_http_methods": [
"POST"
]
},
Most API endpoints require user authentication through an API token.
You can generate an API token in the admin panel.
Note
The CRCON admin interface can be reached from all over the world, in any web browser.
For example (replace 123.123.123.123
with your VPS IP) :
-
Server 1 :
http://123.123.123.123:8010/admin
-
Server 2 :
http://123.123.123.123:8011/admin
-
Server 3 :
http://123.123.123.123:8012/admin
Each token you'll create will get the permissions of the user it belongs.
We advise you to create dedicated users for each API token you'll use, so you'll be able to give them specific permissions.
Create new user with permissions you wish for the API key to have.
- Login to the Admin interface at
http://(your VPS IP):8010/admin
- Click the '+Add' link, next to users
- Enter username and password and click
Save and continue editing
- The password can be random and forgotten, Steam ID isn't required.
- Ensure that the account has the
Active
checkbox checked. - Provide permission to user
- You can give specific permissions to each user via the Permissions section or Groups.
- If you want your API token to have full permissions, give "superuser" status to the user.
- Save your new user account.
- Login to the Admin interface at
http://(your VPS IP):8010/admin
- Click the
+Add
link, next toDjango API Keys
Important
The API key will be provided in next step, make sure you copy this down and save it. You will not see it again.
- Fill out API details and click
Save
- Select the user that will own the API Key.
- Add notes (great for tracking API keys)
curl https://(your VPS IP):8010/api/get_map_rotation -H "Authorization: Bearer <django-api-token>"
curl -X POST https://(your VPS IP):8010/api/get_historical_logs -H "Authorization: Bearer <django-api-token>" -d '{"log_type":"KILL",
"limit":9999}'
curl -X POST https://(your VPS IP):8010/api/get_gamestate -H "Authorization: Bearer <django-api-token>"
import requests
headers = {
"Authorization": "bearer 12345678-your-api-token-123456789",
"Connection": "keep-alive",
"Content-Type": "application/json"
}
data_request={
"player": "ThisGuy",
"steam_id_64": "765611981123456952",
"message": "test"
}
foo = requests.post("http://(your VPS IP):8010/api/do_message_player", data=json.dumps(data_request), headers=headers)
You can use Postman to send API requests to your CRCON.
Example config in Postman :
Hell Let Loose (HLL) Community RCON (CRCON) Wiki - Back to Home
- Home
- Views
- Maps
- Records
- Settings
- Webhooks
- Automods
- Others
- Stats
- Admin panel (needs update)
- Migrate CRCON to another VPS
- Replace the game server managed in CRCON
- Adding a game server to manage in CRCON
- Overview Project Structure
- Development environment
- Building your own Docker images
- CRCON API
- Streaming Logs
- Remotely connect to the PostgreSQL database
- Miscellaneous (needs update)
- HLL RCON Commands (needs update)
- Please look at this first
- Ask for help