Skip to content
HarpyWar edited this page Jan 24, 2013 · 6 revisions

Usage of server API controller:

http://example.com/server/api.php?apikey={APIKEY}&do={METHOD}&{PARAMS}

Request type is always GET. The each method returns JSON with response result or error:

{'result':'data'}
or 
{'error':'message'}

serverlist

Get list of installed servers

Return

servers array where each item includes: id, status and name

Example

api.php?do=serverlist

{"result":{"1":{"id":1,"status":true,"hostname":"Server #1"},"2":{"id":2,"status":false,"hostname":"Server #2"}}}

status

Get status of windows server (service can be started but nfk server is not responding)

Parameters

  • id - server id

Return

true (running) or false (stopped)

Example

api.php?do=status&id=1

{"result":false}

start

Start server

Parameters

  • id - server id

Return

true

Example

api.php?do=start&id=1

{"result":true}

stop

Stop server

Parameters

  • id - server id

Return

true

Example

api.php?do=stop&id=1

{"result":true}

editname

Edit server name in config

Parameters

  • id - server id
  • name - command text (urlencoded)

Return

edited server name

Example

api.php?do=editname&id=1&name=%5E%21server%20name%20%231

{"result":"^!server name #1"}

getlog

Get log data from a specified position

Parameters

  • id - server id
  • pos - log file position to start read from (if not passed or equal 0 then read maximum allowed size from the end of log)

Return

array with current pos and data (pos can be used for next method call to get only updated chunk of log)

Example

api.php?do=getlog&id=1&pos=1000

{"result":{"pos":424408,"data":"[1\/24\/2013 3:44:22 AM] console: \"r_wateralpha\" is set t..."}}

scc

Send console command to server

Parameters

  • id - server id
  • cmd - command text (urlencoded)

Return

true

Example

api.php?do=scc&id=1&cmd=say%20hello

{"result":true}
Clone this wiki locally