/management/wls/{version}/deployments/application

This resource manages the applications that are deployed in this WLS domain.

The resource supports the following methods:

GET Method

The GET method on this resource returns a listing of all the applications in this WLS domain.

Roles

Administrator, Deployer, Operator, Monitor

Request Query Parameters

This method supports optional query parameters which can be used to constrain the fields included in the response. Constraining the fields to only the information that you require may yield faster response times when interacting with large data sets.

?_excludeFields=field1[,field2, ...]

(optional) Specifies that these values are not required and may be omitted in a response.

?_includeFields=field1[,field2, ...]

(optional) Specifies that these values are required and must be included in the response.

Include and exclude are mutually exclusive, and if neither is specified all available information is included.

Response Body

The response body returned includes a collection of Application entities. It also contains links to their corresponding resources.

This method can return the following links:

  • uri=/management/wls/{version}/deployments rel=parent

  • uri=/management/wls/{version}/deployments/application/id/{application-name} rel=items.name title=name

Response Codes

This method returns one of the Standard HTTP Status Codes.

Example

Example 1   Viewing Applications

This example uses the GET method to list all the applications in this WLS domain.

Example Request

curl -v \
--user username:password \
-H X-Requested-By:MyClient \
-H Accept:application/json \
-X GET http://localhost:7001/management/wls/latest/deployments/application

Example Response

HTTP/1.1 200 OK

Response Body:
{
    "links": [
        {
            "rel": "parent",
            "uri": "http:\/\/localhost:7001\/management\/wls\/latest\/deployments"
        },
        {
            "rel": "items.name",
            "uri": "http:\/\/localhost:7001\/management\/wls\/latest\/deployments\/application\/id\/fairShare",
            "title": "fairShare"
        }
    ],
    "items": [{
        "name": "fairShare",
        "state": "active",
        "type": "application",
        "targets": [
            "myserver",
            "Cluster-0"
        ],
        "servlets": [
            {
                "servletName": "SimpleSlowServlet",
                "contextPath": "\/fairShare",
                "aggregateMetrics": {
                    "executionTimeTotal": 0,
                    "invocationTotalCount": 0,
                    "reloadTotalCount": 0,
                    "executionTimeHigh": 0,
                    "executionTimeLow": 0
                },
                "servletMetrics": [
                    {
                        "serverName": "myserver",
                        "executionTimeTotal": 0,
                        "invocationTotalCount": 0,
                        "reloadTotalCount": 0,
                        "executionTimeHigh": 0,
                        "executionTimeLow": 0
                    }
                ]
            },
            {
                "servletName": "SimpleFastServlet",
                "contextPath": "\/fairShare",
                "aggregateMetrics": {
                    "executionTimeTotal": 0,
                    "invocationTotalCount": 0,
                    "reloadTotalCount": 0,
                    "executionTimeHigh": 0,
                    "executionTimeLow": 0
                },
                "servletMetrics": [
                    {
                        "serverName": "myserver",
                        "executionTimeTotal": 0,
                        "invocationTotalCount": 0,
                        "reloadTotalCount": 0,
                        "executionTimeHigh": 0,
                        "executionTimeLow": 0
                    }
                ]
            },
            {
                "servletName": "JspServlet",
                "contextPath": "\/fairShare",
                "aggregateMetrics": {
                    "executionTimeTotal": 0,
                    "invocationTotalCount": 0,
                    "reloadTotalCount": 0,
                    "executionTimeHigh": 0,
                    "executionTimeLow": 0
                },
                "servletMetrics": [
                    {
                        "serverName": "myserver",
                        "executionTimeTotal": 0,
                        "invocationTotalCount": 0,
                        "reloadTotalCount": 0,
                        "executionTimeHigh": 0,
                        "executionTimeLow": 0
                    }
                ]
            },
            {
                "servletName": "FileServlet",
                "contextPath": "\/fairShare",
                "aggregateMetrics": {
                    "executionTimeTotal": 0,
                    "invocationTotalCount": 0,
                    "reloadTotalCount": 0,
                    "executionTimeHigh": 0,
                    "executionTimeLow": 0
                },
                "servletMetrics": [
                    {
                        "serverName": "myserver",
                        "executionTimeTotal": 0,
                        "invocationTotalCount": 0,
                        "reloadTotalCount": 0,
                        "executionTimeHigh": 0,
                        "executionTimeLow": 0
                    }
                ]
            }
        ],
        "displayName": "fairShare",
        "urls": [
            "http:\/\/localhost:7001\/fairShare"
        ],
        "planPath": null,
        "applicationType": "war",
        "openSessionsCurrentCount": 0,
        "sessionsOpenedTotalCount": 0,
        "health": {"state": "ok"},
        "deploymentPath": "\/deployments\/fairShare.war",
        "ejbs": []
    }]
}

OPTIONS Method

The OPTIONS method on this resource returns a template entity that has been pre-populated with default values.

If you want to deploy an application, call this method to get the template, fill in values, such as the path to the application, then use it in the POST method to deploy the application.

Roles

Administrator

Response Body

The response body returned includes an Application template entity that can be customized and then used to deploy the application.

Response Codes

This method returns one of the Standard HTTP Status Codes.

POST Method

The resource supports the following methods:

POST Accepting "application/json"

This POST method deploys a new application when the files you want to deploy are already on the Administration Server file system.

Roles

Administrator

Request Query Parameters

This resource launches a job to deploy the application.

_detached

(Optional) Specifies whether this method runs in detached (background) mode or synchronously.

If the __detached=true query parameter is specified (detached invocation), then this method returns immediately after launching the job. Otherwise, it waits for the job to complete, fail, or timeout (synchronous invocation).

Request Body

The request body must include a fully populated Application entity that describes the new application. Read only parameter values are ignored.

Response Body

If the method was invoked synchronously and successfully launched the job, the response body includes a DeploymentJob entity containing the state of the job (completed, failed, or still running in the case of a timeout) as well as a link to the job resource.

This method can return the following links:

  • uri=/wls/jobs/deployment/{job-id} rel=job title=id

Response Codes

If the method was invoked synchronously and the job successfully completed, the method returns a 201 Created status code and a Location header with a link to the new application resource. If the job timed out, the method returns a 202 Accepted status code and a Location header with a link to the expected new application resource.

If the method was invoked detached and successfully launched the job, the method returns a 202 Accepted status code, a link to the job resource, and a Location header with a link to the expected new application resource. In this case, the response does not include a DeploymentJob entity.

Example

Example 1   Deploying an Application

This example uses the POST method to deploy a new application.

Example Request

curl -v \
--user username:password \
-H X-Requested-By:MyClient \
-H Accept:application/json \
-H Content-Type:application/json \
-d "{
    name: 'BasicApp',
    deploymentPath: '/deployments/BasicApp/app/BasicApp.ear',
    targets: [ 'myserver' ]
}" \
-X POST http://localhost:7001/management/wls/latest/deployments/application

Example Response

HTTP/1.1 201 Created

Location: http://localhost:7001/management/wls/latest/deployments/application/id/BasicApp

Response Body:
{
    "messages": [{
        "message": "Deployed the application 'BasicApp'.",
        "severity": "SUCCESS"
    }],
    "links": [{
        "rel": "job",
        "uri": "http:\/\/localhost:7001\/management\/wls\/latest\/jobs\/deployment\/id\/0"
    }],
    "item": {
        "operation": "deploy",
        "status": "completed",
        "beginTime": 1390587114114,
        "endTime": 1390587115796,
        "name": "ADTR-0",
        "id": "0",
        "type": "deployment",
        "targets": [{
            "errors": [],
            "status": "completed",
            "name": "myserver",
            "type": "server"
        }],
        "deploymentName": "BasicApp",
        "description": "[Deployer:149026]deploy application BasicApp on myserver."
    }
}
Example 2   Deploying an Application Asynchronously

This example uses the POST method to deploy a new application asynchronously.

Example Request

curl -v \
--user username:password \
-H X-Requested-By:MyClient \
-H Accept:application/json \
-H Content-Type:application/json \
-d "{
    name: 'fairShare',
    deploymentPath: '/deployments/fairShare.war'
}" \
-X POST http://localhost:7001/management/wls/latest/deployments/application?__detached=true

Example Response

 HTTP/1.1 202 Accepted

Location: http://localhost:7001/management/wls/latest/deployments/application/id/fairShare

Response Body:
{
    "messages": [{
        "message": "Deploying the application 'fairShare'.",
        "severity": "SUCCESS"
    }],
    "links": [{
        "rel": "job",
        "uri": "http:\/\/localhost:7001\/management\/wls\/latest\/jobs\/deployment\/id\/31"
    }]
}

POST Accepting "multipart/form-data"

This POST method deploys a new application when the files you want to deploy are not on the Administration Server file system. It uploads the files to deploy from the client's file system to the Administration Server file system and then deploys them.

Note: When using a multi-part form to create, you need to:

  1. Specify the file to deploy via the deployment form element.

  2. Specify the plan to deploy via the plan form element.

  3. Send in the rest of the template via the model form element.

Roles

Administrator

Request Query Parameters

This resource launches a job to upload and deploy the application.

_detached

(Optional) Specifies whether this method runs in detached (background) mode or synchronously.

If the __detached=true query parameter is specified (detached invocation), then this method returns immediately after launching the job. Otherwise, it waits for the job to complete, fail, or timeout (synchronous invocation).

Request Body

The request body includes form data with a Content-Type header of multipart/form-data and the following form fields:

model

(Required) Specifies all the necessary information about the application to deploy except for the deployment archive and its corresponding deployment plan. The Content-Disposition header must have its name parameter set to model. The Content-Type header must be application/json and the content must be a JSON object containing an Application entity, excluding the deployment and plan fields.

deployment

(Required) Specifies the deployment archive to be uploaded. The Content-Disposition header must have its name parameter set to deployment and must have a filename parameter set to the file name you want the uploaded deployment archive to have on the server. The Content-Type header must be application/octet-stream and the content must be the deployment archive data.

plan

(Optional) Specifies the deployment plan to be uploaded. The Content-Disposition header must have its name parameter set to plan and must have a filename parameter set to the file name you want the uploaded deployment plan to have on the server. The Content-Type header must be application/octet-stream and the content must be the deployment plan data.

Response Body

If the method was invoked synchronously and successfully launched the job, the response body includes a DeploymentJob entity containing the state of the job (completed, failed, or still running in the case of a timeout) as well as a link to the job resource.

This method can return the following links:

  • uri=/wls/jobs/deployment/{job-id} rel=job title=id

Response Codes

If the method was invoked synchronously and the job successfully completed, the method returns a 201 Created status code and a Location header with a link to the new library resource. If the job timed out, the method returns a 202 Accepted status code and a Location header with a link to the expected new library resource.

If the method was invoked detached and successfully launched the job, the method returns a 202 Accepted status code, a link to the job resource, and a Location header with a link to the expected new library resource. In this case, the response does not include a DeploymentJob entity.

Example

Example 1   Uploading and Deploying an Application

This example uses the POST method to upload a deployment archive and deploy it as a new application.

Example Request

curl -v \
--user username:password \
-H X-Requested-By:MyClient \
-H Accept:application/json \
-H Content-Type:multipart/form-data \
-F "model={
    name: 'myapp',
    targets: [ 'myserver', 'Cluster-0' ]
}" \
-F "deployment=@/deployments/MyApp/app/MyApp.ear" \
-X POST http://localhost:7001/management/wls/latest/deployments/application

Example Response

HTTP/1.1 100 Continue
 HTTP/1.1 201 Created

Location: http://localhost:7001/management/wls/latest/deployments/application/id/myapp

Response Body:
{
    "messages": [{
        "message": "Deployed the application 'myapp'.",
        "severity": "SUCCESS"
    }],
    "links": [{
        "rel": "job",
        "uri": "http:\/\/localhost:7001\/management\/wls\/latest\/jobs\/deployment\/id\/27"
    }],
    "item": {
        "operation": "deploy",
        "status": "completed",
        "beginTime": 1390587191114,
        "endTime": 1390587192047,
        "name": "ADTR-27",
        "id": "27",
        "type": "deployment",
        "targets": [
            {
                "errors": [],
                "status": "completed",
                "name": "Cluster-0",
                "type": "cluster"
            },
            {
                "errors": [],
                "status": "completed",
                "name": "myserver",
                "type": "server"
            }
        ],
        "deploymentName": "myapp",
        "description": "[Deployer:149026]deploy application myapp on Cluster-0,myserver."
    }
}