API

Post Reply
Masher
Site Admin
Posts: 3558
Joined: Thu Apr 20, 2006 2:54 pm
Location: America's Heartland
Contact:

API

Post by Masher »

The API allows you control the panel using a special URL with various options. You can manage users and servers through the API. If you'd like additional features added to the API please contact us.

The API requires a license.

Version 1.85 renamed the api page to api.ashx.

You may also rename or remove this file if you don't need its functionality.

API Format
To utilize the API, simply make a web request to the api.ashx page (or use uget tool--see below) with the following parameters:

http://somesite.com/api.ashx?u=username&p=password&i=id&c=somecmd
OptionDesc
u=A user name (some commands require an admin account)
p=Password for user
c=The command (see below command list table
i=ID # to perform the command on (typically a server or user ID #)
o1, o2, o3Some API commands take additional options, these are specified using the 'o' options

Implemented commands
CommandDescriptionNotes
aliveAlways returns trueUseful to see if the panel is up
runningReturns true if running, otherwise falsei= specifies id of server to check
panelstatsReturns status of total running servers, total setup servers, total active players connected to all servers, and total max players supported by all servers.Similar to information shown at the top of the main server list menu.
statusReturns status of a server.Possible return values are 'Running', 'Updating', 'Stopped'
statusallReturns a list of servers with their status. Output is similar to listservers2, but includes status.Possible return values for status are 0=stopped, 1=running, 2=updating, 3=pending udpate (graceful shutdown is in progress, then will be updated), 4=pending_restart,5=pending_stop, 6=remote_error, 7=remote_offile, 8=installing
queryReturns query info of serverList format is title, map, players
startStart a serveri= specifies id of server to start
stopStop a serveri= specifies id of server to stop
pidReturns the PID value of server's processReturns 0 if not running.
updateInitiate an update for a serverUse the status command to monitor for when the update is finished.
hashesUpdate hashes for a serverIf using hashes the API will update hashes set for server.
restartRestart a serveri= specifies id of server to restart
restartemptyRestart a server when the amount of players falls below the min player count setting
disablesDisable a servero1 allows passing a reason/comment to the panel. Passing o2=1 will disable the owner's account if it's the last active server on their account.
deletesDelete server from the panelDoes not delete server files, simply removes the server's entry from the database.
deletesfDelete server and its filesRemove from database and delete files (delete from server's root or server working directory)
enablesEnable a server
disableuDisable a user's account
enableuEnable a user's account
extraRun the specified extrai= the ID of the extra deifnition
newuserCreate a new user. o1=account name, 02=email addressReturns a comma separated list with User ID and Password
newuseremailSends account information via email to userWill reset password for account and send that password
listusersReturns a comma separated list of user accountsList is formatted as userid, username, email address
listusers2Identical to listusers, but includes a field indicating if account is activeList is formatted as userid, username, email address,enabled
listserversReturns a comma separated list of serversList is formatted as userid, owner id, server name
listservers2Identical to listservers but includes a field indicating if server is disabledList is formatted as userid, owner id, server name,disabled
serverinfoReturns IP address and game port values of a server.Output is in the format of IP:Port or just IP if port is 0
dbvalReturns a value from the database where i=id of table. o1=<table name>, o2=<column name>For example i=1&o1=servers&o2=friendlyname would return the Friendly name of server id 1
updatedbserverUpdates a value in the database for a server.o1= specifies the column to update, o2= new value
updatedbuserUpdates a value in the database for a user.o1= specifies the column to update, o2= new value
pwReset password for account i=, use o1= for new password
listsdefsList server definitionsList format: id, name, platform, ip
listinstallersList auto installer templatesList format: id, name, gametype, platform
installCreate new server using auto installer, specifying where to install, who to make the owner, and maximum player slots.o1= sdef id, o2= user id, o3= max slots
installfastCreate new server using auto installer and returns new server ID as soon as it's available (install completes in the background), specifying where to install, who to make the owner, and maximum player slots.o1= sdef id, o2= user id, o3= max slots
installfastlocCreate new server using auto installer and returns new server ID as soon as it's available (install completes in the background), specifying the location for the server, a list of installers (one linux, one windows). The installer will pick the least utilized server definition assigned to a location. The panel will use the correct installer based on the platform type of the target server definition. Server is started once deployment is complete and a 'new server' welcome email is sent to owner.i=owner_id, o1= installerid1,installerid2, o2= location_name, o3= max slots
listinstallersList auto installer templatesList format: id, name, gametype, platform
Return values
The panel will return either an
OK: - indicates everything was successful
ERROR: - indicates an error and will typically list an error message.

uget - Commandline API tool
You can use this tool to make api calls from the commandline. See http://www.brainless.us/forum/viewtopic.php?f=21&t=1493 for more information.
Last edited by Masher on Sat Feb 13, 2021 10:53 pm, edited 3 times in total.
Reason: Added new API commands (dbval, deletes, deletesf, pid, panelstats)
Masher
-----------
Please do not PM me unless asked to! We are a small company. If you have an issue or question it would be best to post it in the forums where it can help others in the future.

NEW Join our Discord!
Post Reply