Skip to content
Alexander Bock edited this page Nov 25, 2022 · 4 revisions

This page includes information about the REST API calls that can be made against a running C-Troll application (if that instance has enabled its REST socket. All parameters have to be URL encoded and the C-Troll application might use Basic HTTP authentication, if it is configured as such in its config.json file.

/api

Parameters: None

Returns: An array of all available API endpoints. Each entry in that array has a url key that describes the relative path where the endpoint can be found and a description key that provides a short description about what functionality the endpoint exposes.

/node

Parameters: None

Returns: A list of all nodes that are configured in the C-Troll application. Each entry in that array contains a name key with the name of the node and a isConnected key that indicates whether the Tray application on that node is connected to the C-Troll application at the time when the API call is made.

/cluster

Parameters: None

Returns: An array of all configured clusters that are enabled. Each entry in the array contains a few keys describing individual aspects of the cluster: name: The name of the cluster, nodes: a list of the names of nodes that belong to the cluster, allConnected: a boolean value describing whether all nodes belonging to the cluster are connected

/program

Parameters: None

Returns: A list of all programs that are available to the C-Troll application. Each entry in the list has more detailed information about the program. name: The name of the program, tags: An array of all assigned tags, configurations: An array of the names of all configurations that are available for that program, clusters: A list of names of clusters on which the program can be run

/program/start

Parameters:

  • program [ string ]: The name of the program that should be started
  • configuration [ string ]: The name of the configuration for the program that should be started
  • cluster [ string ]: The name of the cluster on which the program should be started Returns: Nothing

Starts the defined program through C-Troll. This command does not check whether the program is already running and will start the same program multiple times.

Examples

  • PowerShell (no password): Invoke-WebRequest -Uri "http://localhost:8000/program/start" -Method POST -Body @{program="Calc";cluster="Local";configuration="Default"}
  • PowerShell (with username "abc" and password "def"): Invoke-WebRequest -Uri "http://localhost:8000/program/start" -Method POST -Body @{program="Calc";cluster="Local";configuration="Default"} -Headers @{Authorization = "Basic $([System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("abc:def")))"}

/program/stop

Parameters:

  • program [ string ]: The name of the program that should be started
  • `configuration [ string ]: The name of the configuration for the program that should be started
  • cluster [ string ]: The name of the cluster on which the program should be started Returns: Nothing

Stops the defined program. This command does nothing if the program is not currently running.

Clone this wiki locally