RESTful API

Warp includes a RESTful interface that makes it easier for other tools to talk to it, e. g. to integrate Warp in a big pipeline. The API is disabled by default. Here are the steps needed to enable it:

  • Launch an elevated command prompt.
  • Type the following commands:
    netsh http add iplisten 0.0.0.0:PORT
    netsh http add urlacl url=http://+:PORT/Warp user="DOMAIN\Domain Users"

    Where you replace “PORT” with an integer port number that is free on your system (e.g. 2143), and “DOMAIN\Domain Users” with the domain (optional) and user name that will launch Warp.

  • If you haven’t launched Warp yet, launch it and close it.Open the global.settings file in the installation directory and find the following line:
    <Param Name="APIPort" Value="-1" />
  • Set the value to the same integer you used before for PORT.That’s it! When you launch Warp now, it should be listening for API calls. If it crashes upon launch, try running it as administrator. If that works, the port assignment you performed previously through the command prompt likely didn’t work. Either try that again with a different port number, or contact your IT staff to find out what’s wrong.

Methods

The following methods can be called by sending a GET or POST HTTP request to http://localhost:PORT/Warp/METHODNAME. If the method returns a value, it will be formatted as JSON. Here is the full code that specifies the interface.

GetSettingsAll (GET)
Returns a structure containing all of the current settings. You can also call GetSettings{General, Import, CTF, Movement, Grids, Picking, Export, Tomo, Filter} to get only a specific set of settings.

GetProcessingStatus (GET)
Returns “processing”, “stopping”, or “stopped”, depending on the current status of on-the-fly processing.

StartProcessing (POST)
Starts on-the-fly processing, or does nothing if it is already running.

StopProcessing (POST)
Stops on-the-fly processing, or does nothing if it is already stopped or stopping.

LoadSettings (POST)
Expects a JSON-formatted “path” tuple with the absolute path to a settings file, e. g. {“path” : “C:/path/to/previous.settings”}.
All settings from that file will be loaded. If the file specifies a different folder, Warp will switch to that folder. The method will fail if on-the-fly processing is currently running, or if the file does not exist.