curl -k -u jsmith:passw0rd
https://hostname:port/cli/component?active=true
-X GET
This example uses the user name jsmith and the password passw0rd. In most cases, create a dedicated user account for the REST commands to use and give that account the appropriate permissions.
Use the host name and port of your server for hostname and port. For example, if the host name is ucdeploy.example.org and the port is the default value of 8443, the curl command might look like the following example:curl -k -u jsmith:passw0rd
https://ucdeploy.example.com:8443/cli/component?active=true
-X GET
The
response for this command is a JSONArray list of all active components on the server. For an
example of this response, see Get information about all components on the server.curl -k -u jsmith:passw0rd
"https://ucdeploy.example.com:8443/cli/
version/getLink?component=JPetStore-APP
&version=1.0
&linkName=IBM%20web%20site"
In
this case, each parameter and value pair are appended to the URL, after a question mark
(?). An ampersand (&) separates each pair. Because
curl is a Linux command and the
ampersand has a special meaning on the Linux command
line, the URL, including the parameters, is enclosed in quotes.{
"description": "Description",
"enforceCompleteSnapshots": "Specify true to require
an explicit version for each component",
"name": "Application name or ID",
"notificationScheme": "Notification scheme"
}
This template is listed in the reference information
for the command; see Create an application from a JSON file.{
"description": "My new application",
"enforceCompleteSnapshots": "false",
"name": "My Application",
"notificationScheme": "Default Notification Scheme"
}
To
pass this JSON string to the application/create resource, you can either
save the string to a file or include it in the command. For example, if you save the string
to a file that is named newApplication.json, the command looks like the
following
example:curl -k -u jsmith:passw0rd
https://ucdeploy.example.com:8443/cli/application/create
-X PUT -d @newApplication.json
You
can also pass the string directly to the command, as shown in the following
example:curl -k -u jsmith:passw0rd
https://ucdeploy.example.com:8443/cli/application/create
-X PUT
-d {"description":"My new application",
"enforceCompleteSnapshots":"false",
"name":"My Application 67",
"notificationScheme":"Default Notification Scheme"}
There are two main ways to get the template of the JSON string for a command. The templates are listed in the reference information for each command. You can also run the equivalent command-line client command with the -t option. Running the CLI command with this option prints the JSON template.
Because the server interface uses the REST API, you can also log in to the server as usual and monitor the requests that the web application generates. You can monitor these requests with web browser extensions or external programs. For example, to see the JSON string for the PUT method of the resource/create resource, create a resource on the web server as usual and then look at the JSON string in the browser request, as shown in the following figure. The JSON string for the REST commands is the same or similar to this string.