Basic command execution


Executes a single command on a remote machine and returns its exit code and standard output. The execution time is limited to 10000 ms.

Security note! All the methods described below are secured. Authentication requires sending a user proxy certificate (support for SimpleCA signed proxies only) through a request header with the PROXY name and a Base64 encoded proxy as the value.
Title Execute command
URL /api/process
Method POST
URL params None
Data params

JSON:

{
  "host": [string (required)],
  "command": [string (required)],
  "working_directory": [string (optional)]
}

Example:

{
  "host": "zeus.cyfronet.pl",
  "command": "date"
}
  						
Success response

Code: 200

Example:

{
  "status":"OK",
  "exit_code":0,
  "standard_output":"Fri Aug  1 14:33:55 CEST 2014",
  "error_output":"",
  "error_message":null
}
  					
Error response

Error response: 408 | 422 | 500

Example:

{
  "status":"ERROR",
  "exit_code":-1,
  "standard_output":"whatever was printed before timeout",
  "error_output":"",
  "error_message":"timeout occurred..."
}
  					
Sample call

Bash (with base64, tr and curl)

proxy="`cat {path-to-proxy-file} | base64 | tr -d '\n'`"

curl -k -X POST --data '{"host": "zeus.cyfronet.pl", "command": "pwd"}' \
--header "Content-Type:application/json" --header "PROXY:$proxy" https://submit.plgrid.pl/api/process
  						
Notes None