Examples of REST API commands
Many REST and command-line client commands have examples in their help topics. A few more examples using various programming languages and scenarios are provided here. The commands are similar for the server.
Complete scenarios
For complete examples of using several REST commands together, see the following pages:Authentication
To run commands, you must first authenticate to the server. See Authenticating for REST commands.Running REST commands in process steps
Plug-ins contain many steps that do the same tasks as REST API commands, but if you want to
run a REST command as part of a process, one way to do so is to use the Send HTTP Call step
in the Web Utilities plugin. To use the REST API with this step, add the step to a process
and specify the following information:
- Name
- Specify a name for the step.
- URL
- Specify the complete URL of the command. For example, to use the command Get information about all applications on the server, specify the
URL
https://deploy.example.com:8443/cli/application
, using the host name or IP address of your server fordeploy-server.example.com
. - HTTP Method
- Specify the method for the command, such as GET or PUT. For the method to use, see the documentation for the command.
- Headers
- Specify any headers for the command, separated by line breaks. If the command requires headers, the headers are listed in the documentation for the command.
- Data / Data File
- Specify the data payload to send along with the command or a file that contains the data.
- Request Content Type
- Select the content type of the data. This field sets the value of the Accept and Content-Type headers.
- Allow Untrusted SSL Certs
- Select the check box to ignore untrusted certifications, such as self-signed certificates.
- Username
- Specify the user name with which to run the command. Running a command with the REST API requires the same permissions as using the web interface.
- Password
- Specify the password with which to run the command.
- Output file
- Optionally, specify a file name to store the result of the command.
Running REST commands in the command-line interface
The Linux™ program curl is one of many programs that can run REST commands from the command line. For an example, see Running REST commands.
Running REST commands in Java™
For an example of running REST commands in Java™, see Authenticating for REST commands.
Running REST commands in Python
For an example of running REST commands in Python, see Authenticating for REST commands.