5.4. Create an Application

Description
Create a new OpenShift Online application. You must first create a domain before you can create an application. See Section 4.2, “Create a Domain” for more information on how to create a domain.
Method and URL Structure
Method URL Structure
POST https://openshift.redhat.com/broker/rest/domains/[Domain_ID]/applications
Request Parameters
Name Description Type Optional Valid Options Default Value
name Name of application String No Not applicable Not applicable
cartridge Framework-type, e.g: php-5.3 Array No nodejs-0.6; jbossas-7; python-2.6; jenkins-1.4; ruby-1.8; diy-0.1; php-5.3; perl-5.10 Not applicable
scale Mark application as scalable Boolean Yes true or false false
gear_profile Size of the gear String Yes small; medium small
initial_git_url URL to Git source repository String Yes Not applicable Not applicable
cURL Command Example
$ curl -k -X POST https://openshift.redhat.com/broker/rest/domains/[Domain_ID]/applications --user "[UserName]:[Password]" --data "name=[AppName]&cartridge=php-5.3&scale=false"
Response
The API returns information about the newly created application, with related resource links. See Chapter 5, Applications for more information on all application parameters.
Sample JSON Response
The sample response output shows successful creation of an OpenShift Online application. In this example, a PHP application named myapp has been created under the domain named MyDomain. The related resource links returned by the API have been removed for brevity.
$ curl -k -X POST https://openshift.redhat.com/broker/rest/domains/MyDomain/applications --user "user@myemail.com:password" --data "name=myapp&cartridge=php-5.3&scale=true"
{
    "data": {
        "aliases": [],
        "app_url": "http://myapp-MyDomain.rhcloud.com/",
        "build_job_url": null,
        "building_app": null,
        "building_with": null,
        "creation_time": "2013-04-22T03:12:13Z",
        "domain_id": "MyDomain",
        "embedded": {
            "haproxy-1.4": {}
        },
        "framework": "php-5.3",
        "gear_count": 1,
        "gear_profile": "small",
        "git_url": "ssh://5174aa8ddbd93c117a0001dc@myapp-MyDomain.rhcloud.com/~/git/myapp.git/",
        "health_check_path": "health_check.php",
        "initial_git_url": null,
        "links": {
            "GET": {
                "href": "https://openshift.redhat.com/broker/rest/domains/MyDomain/applications/myapp",
                "method": "GET",
                "optional_params": [],
                "rel": "Get application",
                "required_params": []
            },
	    "name": "myapp",
        "scalable": true,
        "ssh_url": "ssh://5174aa8ddbd93c117a0001dc@myapp-MyDomain.rhcloud.com",
        "uuid": "5174aa8ddbd93c117a0001dc"
    },
    "errors": {},
    "messages": [
        {
            "exit_code": null,
            "field": null,
            "severity": "info",
            "text": "Application myapp was created."
        },
        {
            "exit_code": 0,
            "field": "current_ip",
            "severity": "info",
            "text": "184.72.206.227"
        },
        {
            "exit_code": 0,
            "field": "result",
            "severity": "info",
            "text": ""
        }
    ],
    "status": "created",
    "type": "application",
}