Puppet Enterprise 2017.3

The list of commands that the Razor server supports is returned as part of a request to GET /api in the commands array. Clients can identify commands using the rel attribute of each entry in the array, and should make their POST requests to the URL given in the id attribute.

The id URL for each command supports the following HTTP methods:

  • GET — Retrieve information about the command, such as a help text and machine-readable information about the parameters this command takes.

  • POST — Execute the command. Command parameters are supplied in a JSON document in the body of the POST request.

Commands are generally asynchronous and return a status code of 202 Accepted on success. The response from a command generally has this form:

   {
     "result":"Policy win2012r2 disabled",
     "command":"http://razor:8088/api/collections/commands/74"
   }

Here, result is a human-readable explanation of what the command did, and command points into the collection of all the commands that were ever run against this server. Performing a GET against the command URL provides additional information about the execution of this command, such as the status of the command, the parameters sent to the server, and details about errors.

Tip: Most client commands allow positional arguments, which can save keystrokes.
Back to top