Application (POST)

Deploys an application.

Description

It first checks whether the input application is valid. Then, it transfers the application to the database and to the runtime.

This transaction can run synchronously or asynchronously. If processed asynchronously, the REST service returns before the transaction is completed. In this case, you can query the transaction result later with the transaction REST service.

Roles

Users in the following roles are authorized to perform this operation:

  • worklightadmin
  • worklightdeployer

Method

POST

Path

/management-apis/1.0/runtimes/runtime-name/applications

Example

https://www.example.com/worklightadmin/management-apis/1.0/runtimes/myruntime/applications?async=false&locale=de_DE

Path Parameters

runtime-name
The name of the runtime. This is the context root of the runtime web application, without the leading slash.

Query Parameters

Query parameters are optional.

async
Whether the transaction is processed synchronously or asynchronously. Allowed values are true and false. The default is synchronous processing.
locale
The locale used for error messages.

Consumes

multipart/form-data

Produces

application/json, application/xml, text/xml, text/html

Response

The metadata of the deployed application.

JSON Example

{
  "ok" : false,
  "productVersion" : "7.1.0",
  "transaction" : {
    "appServerId" : "Tomcat",
    "description" : {
      "appVersionsAlreadyDeployed" : [
        {
          "applicationName" : "myapplication",
          "environment" : "android",
          "version" : "1.0",
        },
        ...
      ],
      "appVersionsDeployed" : [
        {
          "applicationName" : "myapplication",
          "environment" : "android",
          "version" : "1.0",
        },
        ...
      ],
      "filename" : "myapplication.wlapp",
    },
    "errors" : [
      {
        "details" : "An internal error occured.",
      },
      ...
    ],
    "id" : 1,
    "project" : {
      "name" : "myproject",
    },
    "status" : "FAILURE",
    "timeCreated" : "2014-04-13T00:18:36.979Z",
    "timeUpdated" : "2014-04-14T00:18:36.979Z",
    "type" : "UPLOAD_APPLICATION",
    "userName" : "demouser",
  },
}

XML Example

<?xml version="1.0" encoding="UTF-8"?>
<deploy-application-result
  ok="false"
  productVersion="7.1.0">
  <transaction
    appServerId="Tomcat"
    id="1"
    status="FAILURE"
    timeCreated="2014-04-13T00:18:36.979Z"
    timeUpdated="2014-04-14T00:18:36.979Z"
    type="UPLOAD_APPLICATION"
    userName="demouser">
    <description filename="myapplication.wlapp">
      <appVersionsAlreadyDeployedArray>
        <appVersionsAlreadyDeployed
          applicationName="myapplication"
          environment="android"
          version="1.0"/>
        ...
      </appVersionsAlreadyDeployedArray>
      <appVersionsDeployedArray>
        <appVersionsDeployed
          applicationName="myapplication"
          environment="android"
          version="1.0"/>
        ...
      </appVersionsDeployedArray>
    </description>
    <errors>
      <error details="An internal error occured."/>
      ...
    </errors>
    <project name="myproject"/>
  </transaction>
</deploy-application-result>

Response Properties

The response has the following properties:

ok
Whether the transaction was successful.
productVersion
The exact product version.
transaction
The details of the transaction.

The transaction has the following properties:

appServerId
The id of the web application server.
description
The details of the application.
errors
The errors occurred during the transaction.
id
The id of the transaction.
project
The current project.
status
The state of the transaction: PENDING, PREPARING, COMMITTING, REJECTING, SUCCESS, FAILURE, CANCELED. Synchronous transactions can have the state SUCCESS and FAILURE. Asynchronous transactions can also have the other states.
timeCreated
The date in ISO 8601 format when the adapter was created.
timeUpdated
The date in ISO 8601 format when the adapter was updated.
type
The type of the transaction, here always UPLOAD_APPLICATION.
userName
The user that initiated the transaction.

The description has the following properties:

appVersionsAlreadyDeployed
The app versions that were already previously deployed and remain unchanged.
appVersionsDeployed
The app versions deployed.
filename
The optional file name of the application.

The app version has the following properties:

applicationName
The name of the application.
environment
The environment of the application.
version
The version of the application.

The error has the following properties:

details
The main error message.

The project has the following properties:

name
The name of the project, which is the context root of the runtime.

Errors

400
No application data is provided.
403
The user is not authorized to call this service.
404
The corresponding runtime is not found or not running.
500
An internal error occurred.