This API is enabled by setting the httpserver option to a port number (suggested 8080) in the options.ini file.
httpserver
options.ini
Once enabled, you can access this page at http://localhost:8080, substituting the port number you configured in place of 8080 if necessary. (EmptyEpsilon serves all files in the www folder, including any you add to it.)
8080
www
The main API endpoint is /exec.lua, which can run any Lua code passed as the data in a POST request and returns the result. Regardless of whether the script is successful, the request returns HTTP code 200. Any output from the script is returned in the response body. See the script reference for a list of functions you can call.
/exec.lua
You can send a script to this endpoint by entering it in the sandbox to the left and clicking the Send button to run it. The results appear in the text area to the right.
The /get.lua endpoint calls Lua-exposed script functions to retrieve data and returns their results in a dictionary. Each function can be passed to the endpoint as a separate parameter of a GET request. Use the _OBJECT_=someObjectGetter() parameter to select the function call's target object. The default object is getPlayerShip(-1), which typically represents the most recently created player ship.
/get.lua
_OBJECT_=someObjectGetter()
getPlayerShip(-1)
This endpoint returns the requested data if successful, or an error (such as {"ERROR": "Script error"}) on failure.
You can send a request to this endpoint by entering function calls as URL parameters in the sandbox to the left, and then clicking the Send button. The results appear in the text area to the right.
The /set.lua endpoint calls Lua-exposed setter functions, such as setShieldsActive. Each function can be passed to the endpoint as a separate parameter of a GET request. Use the _OBJECT_=someObjectGetter() parameter to select the function call's target object. The default object is getPlayerShip(-1), which typically represents the most recently created player ship.
/set.lua
setShieldsActive
This endpoint returns nothing if successful, or an error (such as {"ERROR": "Script error"}) on failure.
You can send a request to this endpoint by entering function calls as URL parameters in the sandbox to the left, and then clicking the Send button. The results (if any) appear in the text area to the right.