10.4. Deploy with the HTTP API
10.4.1. Deploy an application using the HTTP API
Summary
Applications can be deployed via the HTTP API using the following instructions.
Prerequisites
- Add the user for the management interfaces. For information on creating the initial administrative user for the remote management interfaces, refer Section 4.2.1, “Add the User for the Management Interfaces”
Procedure 10.8. Deploy an application using HTTP API
- Use either the
deploy
orundeploy
command relevant to your requirements.Example 10.2. Deploy and undeploy command
Deploy ------------------------------ curl --digest -L -D - http://<host>:<port>/management --header "Content-Type: application/json" -d '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "add", "address" : {"deployment" : "<runtime-name>"}, "content" : [{"url" : "file:<path-to-archive>}]},{"operation" : "deploy", "address" : {"deployment" : "<runtime-name>"}}],"json.pretty":1}' -u <user>:<pass> Example: ------- curl --digest -L -D - http://localhost:9990/management --header "Content-Type: application/json" -d '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "add", "address" : {"deployment" : "example.war"}, "content" : [{"url" : "file:/home/$user/example.war"}]},{"operation" : "deploy", "address" : {"deployment" : "example.war"}}],"json.pretty":1}' -u user:password Undeploy ------------------------------ curl --digest -L -D - http://<host>:<port>/management --header "Content-Type: application/json" -d '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "undeploy", "address" : {"deployment" : "<runtime-name>"}},{"operation" : "remove", "address" : {"deployment" : "<runtime-name>"}}],"json.pretty":1}' -u <user>:<pass> Example: ------- curl --digest -L -D - http://localhost:9990/management --header "Content-Type: application/json" -d '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "undeploy", "address" : {"deployment" : "example.war"}},{"operation" : "remove", "address" : {"deployment" : "example.war"}}],"json.pretty":1}' -u user:password
Note
To know more about programmatically generating the JSON requests, refer https://access.redhat.com/solutions/82463.