Process to API Web Server



Web server providing API endpoint that can be used to execute a process and respond back with expected output.


Download

proc2apiws.web.jar

Source code

Repository @ GitHub

Limitations

Requirements

Usage

java -jar proc2apiws.web.jar --configPath [CONFIG_PATH]

Options

-pt, --configPath [CONFIG_PATH] - Path of configuration JSON file

Example

With following configuration JSON file named config.json in same folder as program file:

  {
    "port": 8080,
    "host": "127.0.0.1",
    "pathRestrict": "./",
    "command": ["$currentJava$","-jar","./example.jar"],
    "parameters": [
      { "form": "parameter", "process": "--parameter" }
    ],
    "outputType": "string",
    "outputFilename": "output.txt",
    "outputContentType": "text/txt",
    "serverName": "example.kobalt.dev",
    "serverLocation": "/submit/"
  },
  {
    "port": 8081,
    "host": "127.0.0.1",
    "pathRestrict": "./",
    "command": ["$currentJava$","-jar","./sample.jar"],
    "parameters": [
      { "form": "input", "stdin": true }
    ],
    "outputType": "binary",
    "outputFilename": "$originalFilename$.zip",
    "outputContentType": "application/zip",
    "serverName": "sample.kobalt.dev",
    "serverLocation": "/submit/"
  }
]

The following command will start two servers running at ports 8080 and 8081, providing single endpoint for each at "/submit/" path:

java -jar proc2apiws.web.jar --configPath "./config.json"

Note: Check the source code for configuration file information.

License

This program is licensed under AGPL-3.0-only.