Contents |
API V1 DOCS
Crafty Controller will be decommissioning API v1 with the release of 4.2.1. Please port all programs using API v1 to use API v2 before updating to 4.2.1. API v2 reference can be found here API V2
Get Node Stats
Returns: JSON of host stats
GET Request Endpoint:
/api/v1/stats/node
Field | Type | Description |
---|---|---|
token | API Token | Token provided by Crafty |
Example Response:
{ "code": { "boot_time": "2022-05-02 15:14:08", "cpu_usage": 10.7, "cpu_count": 4, "cpu_cur_freq": 2800, "cpu_max_freq": 2800, "mem_percent": 55.8, "mem_usage": "8.8GB", "mem_total": "16.0GB", "disk_data": [ { "device": "/dev/disk1s5s1", "total": "931.6GB", "used": "14.3GB", "free": "290.4GB", "percent_used": 4, "fs": "apfs", "mount": "/" }, { "device": "/dev/disk1s4", "total": "931.6GB", "used": "1.0GB", "free": "290.4GB", "percent_used": 0, "fs": "apfs", "mount": "/System/Volumes/VM" }, { "device": "/dev/disk1s2", "total": "931.6GB", "used": "364.1MB", "free": "290.4GB", "percent_used": 0, "fs": "apfs", "mount": "/System/Volumes/Preboot" }, { "device": "/dev/disk1s6", "total": "931.6GB", "used": "596.0KB", "free": "290.4GB", "percent_used": 0, "fs": "apfs", "mount": "/System/Volumes/Update" }, { "device": "/dev/disk1s1", "total": "931.6GB", "used": "623.9GB", "free": "290.4GB", "percent_used": 68, "fs": "apfs", "mount": "/System/Volumes/Data" } ] } }
Get All Server Stats
Returns: JSON of all authorized server stats
GET Request Endpoint:
/api/v1/stats/servers
Field | Type | Description |
---|---|---|
token | API Token | Token provided by Crafty |
Example Response:
{ "servers": [ { "server_id": 1, "created": 1650301430.245639, "server_uuid": "32b1daf2-1ee8-40e2-972e-cdc2bd0e437f", "server_name": "Box", "path": "/var/opt/minecraft/crafty-4/servers/32b1daf2-1ee8-40e2-972e-cdc2bd0e437f", "backup_path": "/var/opt/minecraft/crafty-4/backups/32b1daf2-1ee8-40e2-972e-cdc2bd0e437f", "executable": "paper-1.16.5.jar", "log_path": "/var/opt/minecraft/crafty-4/servers/32b1daf2-1ee8-40e2-972e-cdc2bd0e437f/logs/latest.log", "execution_command": "java -Xms1000M -Xmx2000M -jar /var/opt/minecraft/crafty-4/servers/32b1daf2-1ee8-40e2-972e-cdc2bd0e437f/paper-1.16.5.jar nogui", "auto_start": false, "auto_start_delay": 10, "crash_detection": false, "stop_command": "stop", "executable_update_url": "", "server_ip": "127.0.0.1", "server_port": 25565, "logs_delete_after": 0, "type": "minecraft-java" } ] }
Send Command
POST Request Endpoint:
/api/v1/server/send_command
Field | Type | Description |
---|---|---|
token | API Token | Token provided by Crafty |
command | String | Command String |
id | Integer | Server's ID |
Start Server
Sends start command to a server instance matching specified ID
POST Request Endpoint:
/api/v1/server/start
Field | Type | Description |
---|---|---|
token | API Token | Token provided by Crafty |
id | Integer | Server's ID |
Stop Server
Sends stop command to a server instance matching specified ID
POST Request Endpoint:
/api/v1/server/stop
Field | Type | Description |
---|---|---|
token | API Token | Token provided by Crafty |
id | Integer | Server's ID |
Restart Server
Sends restart command to a server instance matching specified ID
POST Request Endpoint:
/api/v1/server/restart
Field | Type | Description |
---|---|---|
token | API Token | Token provided by Crafty |
id | Integer | Server's ID |
List Authorized Servers
Returns: JSON list of all authorized servers for user
GET Request Endpoint:
/api/v1/list_servers
Field | Type | Description |
---|---|---|
token | API Token | Token provided by Crafty |
Example Response:
{ "code": "COMPLETED", "servers": [ "{ 'server_id': 1, 'created': datetime.datetime(2022, 4, 18, 13, 3, 50, 245639), 'server_uuid': '32b1daf2-1ee8-40e2-972e-cdc2bd0e437f', 'server_name': 'Box', 'path': '/var/opt/minecraft/crafty-4/servers/32b1daf2-1ee8-40e2-972e-cdc2bd0e437f', 'backup_path': '/var/opt/minecraft/crafty-4/backups/32b1daf2-1ee8-40e2-972e-cdc2bd0e437f', 'executable': 'paper-1.16.5.jar', 'log_path': '/var/opt/minecraft/crafty-4/servers/32b1daf2-1ee8-40e2-972e-cdc2bd0e437f/logs/latest.log', 'execution_command': 'java -Xms1000M -Xmx2000M -jar /var/opt/minecraft/crafty-4/servers/32b1daf2-1ee8-40e2-972e-cdc2bd0e437f/paper-1.16.5.jar nogui', 'auto_start': False, 'auto_start_delay': 10, 'crash_detection': False, 'stop_command': 'stop', 'executable_update_url': '', 'server_ip': '127.0.0.1', 'server_port': 25565, 'logs_delete_after': 0, 'type': 'minecraft-java' }" ] }
Create User
Creates specified user on crafty instance.
POST Request Endpoint:
/api/v1/users/create_user
Field | Type | Description |
---|---|---|
token | API Token | Token provided by Crafty |
username | String | Desired Username |
password | String | User's password |
Remove User
Removes specified user from installation.
POST Request Endpoint:
/api/v1/users/delete_user
Field | Type | Description |
---|---|---|
token | API Token | Token provided by Crafty |
user_id | integer | Numerical ID of User to remove |