Overview

DescriptionUpdate an application definition.
Resource Path /applications
HTTP MethodPUT
Request/Response Formatapplication/json

Sample request

{  
   "applicationId":"wordpress",
   "alias":"wordpress",
   "components":{  
      "groups":[  
         {  
            "name":"mysql-php-group",
            "alias":"mysql-php-group",
            "groupMinInstances":1,
            "groupMaxInstances":1,
            "cartridges":[  
               {  
                  "type":"mysql",
                  "cartridgeMin":2,
                  "cartridgeMax":5,
                  "subscribableInfo":{  
                     "alias":"my-mysql",
                     "deploymentPolicy":"deployment-policy-2",
                     "autoscalingPolicy":"autoscaling-policy-1"
                  }
               },
               {  
                  "type":"php",
                  "cartridgeMin":2,
                  "cartridgeMax":5,
                  "subscribableInfo":{  
                     "alias":"my-php",
                     "deploymentPolicy":"deployment-policy-2",
                     "autoscalingPolicy":"autoscaling-policy-1",
                     "artifactRepository":{  
                        "privateRepo":false,
                        "repoUrl":"https://github.com/imesh/stratos-php-applications.git"
                     }
                  }
               }
            ]
         }
      ]
   }
}
  • An application can only be multi-tenant, if all cartridges that correspond to the application are multi-tenant.
  • The artifact repository details should not be entered in a multi-tenant application definition. Instead, these details need to be passed in the payload at the time of application sign up.
{
  "applicationId": "single-cartridge-app",
  "alias": "single-cartridge-app",
  "multiTenant": true,
  "components": {
    "cartridges": [
      {
        "type": "php",
        "cartridgeMin": 1,
        "cartridgeMax": 10,
        "subscribableInfo": {
          "alias": "my-php",
          "autoscalingPolicy": "autoscaling-policy-1",
          "deploymentPolicy": "deployment-policy-1"
        }
      }
    ]
  }
} 

For information on all the properties that can be used in an application definition, see the  Application Resource Definition .

> PUT /api/ applications HTTP/1.1

> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8| zlib/1.2.5
> Host: localhost:9443
> Accept: */*
> Content-Type: application/json
> Content-Length: 192

* upload completely sent off: 192 out of 192 bytes
< HTTP/1.1 200 OK
< Date: Tue, 17 Mar 2015 08:28:10 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server


{"status":"success","message":"Application updated successfully: [application] wordpress"}

 

curl -X PUT -H "Content-Type: application/json" -d @'<JSON_PAYLOAD>' -k -v -u admin:admin https://<STRATOS_HOST>:<STRATOS_HTTPS_PORT>/api/applications
  • The path to the JSON file that defines the application needs to be defined as the <JSON_PAYLOAD> value.

  • By default, <STRATOS_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <STRATOS_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.

For example:

cd <STRATOS_SOURCE_HOME>/samples
curl -X PUT -H "Content-Type: application/json" -d @'applications/complex/wordpress-app/artifacts/application.json' -k -v -u admin:admin https://localhost:9443/api/applications
 
CLI command
add-application
DescriptionAdd an application.
Command format
add-application -p <JSON_FILE_PATH>

The path to the JSON file that defines the application needs to be defined as the <JSON_FILE_PATH> value.


REST API response

HTTP status code

200, 400, 409, 500

See the descriptions of the HTTP status codes here.

  • No labels