Skip to content

Latest commit

 

History

History
1609 lines (1260 loc) · 32.1 KB

File metadata and controls

1609 lines (1260 loc) · 32.1 KB

RESTful Marathon

API Version 2

Apps

POST /v2/apps

Create and start a new application.

The full JSON format of an application resource is as follows:

{
    "cmd": "(env && sleep 300)",
    "constraints": [
        ["attribute", "OPERATOR", "value"]
    ],
    "container": {
        "image": "docker:///zaiste/postgresql",
        "options": ["-e", "X=7"]
    },
    "cpus": 2,
    "env": {
        "LD_LIBRARY_PATH": "/usr/local/lib/myLib"
    },
    "executor": "",
    "healthChecks": [
        {
            "protocol": "HTTP",
            "path": "/health",
            "gracePeriodSeconds": 3,
            "intervalSeconds": 10,
            "portIndex": 0,
            "timeoutSeconds": 10
        },
        {
            "protocol": "TCP",
            "gracePeriodSeconds": 3,
            "intervalSeconds": 5,
            "portIndex": 1,
            "timeoutSeconds": 5
        }
    ],
    "id": "my-app",
    "instances": 3,
    "mem": 256.0,
    "ports": [
        8080,
        9000
    ],
    "taskRateLimit": 1.0,
    "tasksRunning": 3, 
    "tasksStaged": 0, 
    "uris": [
        "https://raw.github.com/mesosphere/marathon/master/README.md"
    ], 
    "version": "2014-03-01T23:29:30.158Z"
}
constraints

Valid constraint operators are one of ["UNIQUE", "CLUSTER", "GROUP_BY"]. For additional information on using placement constraints see the Constraints wiki page.

container

Additional data passed to the container on application launch. These consist of an "image" and an array of string options. The meaning of this data is fully dependent upon the executor. Furthermore, it is invalid to pass container options when using the default command executor.

healthChecks

An array of checks to be performed on running tasks to determine if they are operating as expected. Health checks begin immediately upon task launch. For design details, refer to the health checks wiki page.

A health check is considered passing if (1) its HTTP response code is between 200 and 399, inclusive, and (2) its response is received within the timeoutSeconds period. If a task fails more than maxConseutiveFailures health checks consecutively, that task is killed.

Each health check supports the following options:

  • gracePeriodSeconds (Optional. Default: 15): Health check failures are ignored within this number of seconds of the task being started or until the task becomes healthy for the first time.
  • intervalSeconds (Optional. Default: 10): Number of seconds to wait between health checks.
  • maxConsecutiveFailures(Optional. Default: 3) : Number of consecutive health check failures after which the unhealthy task should be killed.
  • path (Optional. Default: "/"): Path to endpoint exposed by the task that will provide health status. Example: "/path/to/health". Note: only used if protocol == "HTTP".
  • portIndex (Optional. Default: 0): Index in this app's ports array to be used for health requests. An index is used so the app can use random ports, like "[0, 0, 0]" for example, and tasks could be started with port environment variables like $PORT1.
  • protocol (Optional. Default: "HTTP"): Protocol of the requests to be performed. One of "HTTP" or "TCP".
  • timeoutSeconds (Optional. Default: 20): Number of seconds after which a health check is considered a failure regardless of the response.
id

Unique string identifier for the app. It must be at least 1 character and may only contain digits (0-9), dashes (-), dots (.), and lowercase letters (a-z). The name may not begin or end with a dash.

(The allowable format is represented by the regular expression ^(([a-z0-9]|[a-z0-9][a-z0-9\\-]*[a-z0-9])\\.)*([a-z0-9]|[a-z0-9][a-z0-9\\-]*[a-z0-9])$.)

ports

An array of required port resources on the host. To generate one or more arbitrary free ports for each application instance, pass zeros as port values. Each port value is exposed to the instance via environment variables $PORT0, $PORT1, etc. Ports assigned to running instances are also available via the task resource.

Example

Request:

POST /v2/apps HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 273
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2

{
    "cmd": "env && sleep 60", 
    "constraints": [
        [
            "hostname", 
            "UNIQUE", 
            ""
        ]
    ], 
    "cpus": "0.1", 
    "env": {
        "LD_LIBRARY_PATH": "/usr/local/lib/myLib"
    }, 
    "id": "my-app", 
    "instances": "3", 
    "mem": "5", 
    "ports": [
        0, 
        0
    ], 
    "uris": [
        "https://raw.github.com/mesosphere/marathon/master/README.md"
    ]
}

Response:

HTTP/1.1 201 Created
Content-Length: 0
Content-Type: application/json
Location: http://localhost:8080/v2/apps/my-app
Server: Jetty(8.y.z-SNAPSHOT)


GET /v2/apps

List all running applications.

Example

Request:

GET /v2/apps HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "apps": [
        {
            "cmd": "env && sleep 60", 
            "constraints": [
                [
                    "hostname", 
                    "UNIQUE", 
                    ""
                ]
            ], 
            "container": null, 
            "cpus": 0.1, 
            "env": {
                "LD_LIBRARY_PATH": "/usr/local/lib/myLib"
            }, 
            "executor": "", 
            "id": "my-app", 
            "instances": 3, 
            "mem": 5.0, 
            "ports": [
                13321, 
                10982
            ], 
            "taskRateLimit": 1.0, 
            "tasksRunning": 1, 
            "tasksStaged": 0, 
            "uris": [
                "https://raw.github.com/mesosphere/marathon/master/README.md"
            ], 
            "version": "2014-04-04T06:25:31.399Z"
        }
    ]
}

GET /v2/apps?cmd={command}

List all running applications, filtered by command.

Example

Request:

GET /v2/apps?cmd=sleep%2060 HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "apps": [
        {
            "cmd": "env && sleep 60", 
            "constraints": [
                [
                    "hostname", 
                    "UNIQUE", 
                    ""
                ]
            ], 
            "container": null, 
            "cpus": 0.1, 
            "env": {
                "LD_LIBRARY_PATH": "/usr/local/lib/myLib"
            }, 
            "executor": "", 
            "id": "my-app", 
            "instances": 3, 
            "mem": 5.0, 
            "ports": [
                13321, 
                10982
            ], 
            "taskRateLimit": 1.0, 
            "tasksRunning": 1, 
            "tasksStaged": 0, 
            "uris": [
                "https://raw.github.com/mesosphere/marathon/master/README.md"
            ], 
            "version": "2014-04-04T06:25:31.399Z"
        }
    ]
}

GET /v2/apps/{appId}

List the application with id appId.

Example

Request:

GET /v2/apps/my-app HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "app": {
        "cmd": "env && sleep 60", 
        "constraints": [
            [
                "hostname", 
                "UNIQUE", 
                ""
            ]
        ], 
        "container": null, 
        "cpus": 0.1, 
        "env": {
            "LD_LIBRARY_PATH": "/usr/local/lib/myLib"
        }, 
        "executor": "", 
        "id": "my-app", 
        "instances": 3, 
        "mem": 5.0, 
        "ports": [
            13321, 
            10982
        ], 
        "taskRateLimit": 1.0, 
        "tasks": [
            {
                "host": "agouti.local", 
                "id": "my-app_0-1396592732285", 
                "ports": [
                    31876, 
                    31877
                ], 
                "stagedAt": "2014-04-04T06:25:32.287Z", 
                "startedAt": "2014-04-04T06:25:32.766Z", 
                "version": "2014-04-04T06:25:31.399Z"
            }
        ], 
        "tasksRunning": 1, 
        "tasksStaged": 0, 
        "uris": [
            "https://raw.github.com/mesosphere/marathon/master/README.md"
        ], 
        "version": "2014-04-04T06:25:31.399Z"
    }
}

GET /v2/apps/{appId}/versions

List the versions of the application with id appId.

Example

Request:

GET /v2/apps/my-app/versions HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "versions": [
        "2014-04-04T06:25:31.399Z"
    ]
}

GET /v2/apps/{appId}/versions/{version}

List the configuration of the application with id appId at version version.

Example

Request:

GET /v2/apps/my-app/versions/2014-03-01T23:17:50.295Z HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate, compress
Host: localhost:8080
User-Agent: HTTPie/0.7.2

Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "cmd": "sleep 60", 
    "constraints": [], 
    "container": null, 
    "cpus": 0.1, 
    "env": {}, 
    "executor": "", 
    "id": "my-app", 
    "instances": 4, 
    "mem": 5.0, 
    "ports": [
        18027, 
        13200
    ], 
    "taskRateLimit": 1.0, 
    "uris": [
        "https://raw.github.com/mesosphere/marathon/master/README.md"
    ], 
    "version": "2014-03-01T23:17:50.295Z"
}

PUT /v2/apps/{appId}

Change parameters of a running application. The new application parameters apply only to subsequently created tasks, and currently running tasks are not pre-emptively restarted.

Example

Request:

PUT /v2/apps/my-app HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 126
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2

{
    "cmd": "sleep 55", 
    "constraints": [
        [
            "hostname", 
            "UNIQUE", 
            ""
        ]
    ], 
    "cpus": "0.3", 
    "instances": "2", 
    "mem": "9", 
    "ports": [
        9000
    ]
}

Response:

HTTP/1.1 204 No Content
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)


Example (version rollback)

If the version key is supplied in the JSON body, the rest of the object is ignored. If the supplied version is known, then the app is updated (a new version is created) with those parameters. Otherwise, if the supplied version is not known Marathon responds with a 404.

Request:

PUT /v2/apps/my-app HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 39
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2

{
    "version": "2014-03-01T23:17:50.295Z"
}
HTTP/1.1 204 No Content
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)

DELETE /v2/apps/{appId}

Destroy an application. All data about that application will be deleted.

Example

Request:

DELETE /v2/apps/my-app HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 0
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 204 No Content
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)


GET /v2/apps/{appId}/tasks

List all running tasks for application appId.

Example (as JSON)

Request:

GET /v2/apps/my-app/tasks HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "tasks": [
        {
            "host": "agouti.local", 
            "id": "my-app_1-1396592790353", 
            "ports": [
                31336, 
                31337
            ], 
            "stagedAt": "2014-04-04T06:26:30.355Z", 
            "startedAt": "2014-04-04T06:26:30.860Z", 
            "version": "2014-04-04T06:26:23.051Z"
        }, 
        {
            "host": "agouti.local", 
            "id": "my-app_0-1396592784349", 
            "ports": [
                31382, 
                31383
            ], 
            "stagedAt": "2014-04-04T06:26:24.351Z", 
            "startedAt": "2014-04-04T06:26:24.919Z", 
            "version": "2014-04-04T06:26:23.051Z"
        }
    ]
}
Example (as text)

Request:

GET /v2/apps/my-app/tasks HTTP/1.1
Accept: text/plain
Accept-Encoding: gzip, deflate, compress
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: text/plain
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

my-app	19385	agouti.local:31336	agouti.local:31364	agouti.local:31382	
my-app	11186	agouti.local:31337	agouti.local:31365	agouti.local:31383	

DELETE /v2/apps/{appId}/tasks?host={host}&scale={true|false}

Kill tasks that belong to the application appId, optionally filtered by the task's host.

The query parameters host and scale are both optional. If host is specified, only tasks running on the supplied slave are killed. If scale=true is specified, then the application is scaled down by the number of killed tasks. The scale parameter defaults to false.

Example

Request:

DELETE /v2/apps/my-app/tasks?host=mesos.vm&scale=false HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 0
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "tasks": []
}

DELETE /v2/apps/{appId}/tasks/{taskId}?scale={true|false}

Kill the task with ID taskId that belongs to the application appId.

The query parameter scale is optional. If scale=true is specified, then the application is scaled down one if the supplied taskId exists. The scale parameter defaults to false.

Example

Request:

DELETE /v2/apps/my-app/tasks/my-app_3-1389916890411 HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 0
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2

Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "task": {
        "host": "mesos.vm",
        "id": "my-app_3-1389916890411",
        "ports": [
            31509,
            31510
        ],
        "stagedAt": "2014-01-17T00:01+0000",
        "startedAt": "2014-01-17T00:01+0000"
    }
}

Tasks

GET /v2/tasks

List tasks of all running applications.

Example (as JSON)

Request:

GET /v2/tasks HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "tasks": [
        {
            "appId": "my-app", 
            "host": "agouti.local", 
            "id": "my-app_2-1396592796360", 
            "ports": [
                31364, 
                31365
            ], 
            "stagedAt": "2014-04-04T06:26:36.362Z", 
            "startedAt": "2014-04-04T06:26:37.285Z", 
            "version": "2014-04-04T06:26:23.051Z"
        }, 
        {
            "appId": "my-app", 
            "host": "agouti.local", 
            "id": "my-app_1-1396592790353", 
            "ports": [
                31336, 
                31337
            ], 
            "stagedAt": "2014-04-04T06:26:30.355Z", 
            "startedAt": "2014-04-04T06:26:30.860Z", 
            "version": "2014-04-04T06:26:23.051Z"
        }, 
        {
            "appId": "my-app", 
            "host": "agouti.local", 
            "id": "my-app_0-1396592784349", 
            "ports": [
                31382, 
                31383
            ], 
            "stagedAt": "2014-04-04T06:26:24.351Z", 
            "startedAt": "2014-04-04T06:26:24.919Z", 
            "version": "2014-04-04T06:26:23.051Z"
        }
    ]
}
Example (as text)

Request:

GET /v2/tasks HTTP/1.1
Accept: text/plain
Accept-Encoding: gzip, deflate, compress
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: text/plain
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

my-app	19385	agouti.local:31336	agouti.local:31364	agouti.local:31382	
my-app	11186	agouti.local:31337	agouti.local:31365	agouti.local:31383	

Event Subscriptions

POST /v2/eventSubscriptions?callbackUrl={url}

Register a callback URL as an event subscriber.

NOTE: To activate this endpoint, you need to startup Marathon with --event_subscriber http_callback

Request:

POST /v2/eventSubscriptions?callbackUrl=http://localhost:9292/callback HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 0
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "callbackUrl": "http://localhost:9292/callback", 
    "clientIp": "0:0:0:0:0:0:0:1", 
    "eventType": "subscribe_event"
}

GET /v2/eventSubscriptions

List all event subscriber callback URLs.

NOTE: To activate this endpoint, you need to startup Marathon with --event_subscriber http_callback

Example

Request:

GET /v2/eventSubscriptions HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "callbackUrls": [
        "http://localhost:9292/callback"
    ]
}

DELETE /v2/eventSubscriptions?callbackUrl={url}

Unregister a callback URL from the event subscribers list.

NOTE: To activate this endpoint, you need to startup Marathon with --event_subscriber http_callback

Example

Request:

DELETE /v2/eventSubscriptions?callbackUrl=http://localhost:9292/callback HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 0
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "callbackUrl": "http://localhost:9292/callback", 
    "clientIp": "0:0:0:0:0:0:0:1", 
    "eventType": "unsubscribe_event"
}

API Version 1 (DEPRECATED)

Apps

POST /v1/apps/start

Example

Request:

POST /v1/apps/start HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 169
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2

{
    "cmd": "sleep 60", 
    "cpus": "0.1", 
    "id": "my-app", 
    "instances": "3", 
    "mem": "5", 
    "ports": [
        0, 
        0
    ], 
    "uris": [
        "https://raw.github.com/mesosphere/marathon/master/README.md"
    ]
}

Response:

HTTP/1.1 204 No Content
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)


GET /v1/apps

Example

Request:

GET /v1/apps HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

[
    {
        "cmd": "sleep 60", 
        "constraints": [], 
        "container": null, 
        "cpus": 0.1, 
        "env": {}, 
        "executor": "", 
        "id": "my-app", 
        "instances": 3, 
        "mem": 5.0, 
        "ports": [
            13024, 
            16512
        ], 
        "taskRateLimit": 1.0, 
        "tasksRunning": 2, 
        "tasksStaged": 0, 
        "uris": [
            "https://raw.github.com/mesosphere/marathon/master/README.md"
        ], 
        "version": "2014-04-04T06:27:40.439Z"
    }
]

POST /v1/apps/stop

Example

Request:

POST /v1/apps/stop HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 15
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2

{
    "id": "my-app"
}

Request:

HTTP/1.1 204 No Content
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)


POST /v1/apps/scale

Example

Request:

POST /v1/apps/scale HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 33
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2

{
    "id": "my-app", 
    "instances": "4"
}

Response:

HTTP/1.1 204 No Content
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)


GET /v1/apps/search?id={appId}&cmd={command}

Example

Request:

GET /v1/apps/search?id=my-app HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

[
    {
        "cmd": "sleep 60", 
        "constraints": [], 
        "container": null, 
        "cpus": 0.1, 
        "env": {}, 
        "executor": "", 
        "id": "my-app", 
        "instances": 3, 
        "mem": 5.0, 
        "ports": [
            17753, 
            18445
        ], 
        "taskRateLimit": 1.0, 
        "uris": [
            "https://raw.github.com/mesosphere/marathon/master/README.md"
        ], 
        "version": "2014-04-04T06:28:07.054Z"
    }
]
Example

Request:

GET /v1/apps/search?cmd=sleep%2060 HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

[
    {
        "cmd": "sleep 60", 
        "constraints": [], 
        "container": null, 
        "cpus": 0.1, 
        "env": {}, 
        "executor": "", 
        "id": "my-app", 
        "instances": 3, 
        "mem": 5.0, 
        "ports": [
            17753, 
            18445
        ], 
        "taskRateLimit": 1.0, 
        "uris": [
            "https://raw.github.com/mesosphere/marathon/master/README.md"
        ], 
        "version": "2014-04-04T06:28:07.054Z"
    }
]

GET /v1/apps/{appId}/tasks

Example

Request:

GET /v1/apps/my-app/tasks HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "my-app": [
        {
            "host": "agouti.local", 
            "id": "my-app_0-1396592878455", 
            "ports": [
                31759, 
                31760
            ]
        }, 
        {
            "host": "agouti.local", 
            "id": "my-app_2-1396592890464", 
            "ports": [
                31991, 
                31992
            ]
        }, 
        {
            "host": "agouti.local", 
            "id": "my-app_1-1396592884460", 
            "ports": [
                31945, 
                31946
            ]
        }, 
        {
            "host": "agouti.local", 
            "id": "my-app_3-1396592896470", 
            "ports": [
                31938, 
                31939
            ]
        }
    ]
}

Endpoints

GET /v1/endpoints

Example (as JSON)

Request:

GET /v1/endpoints HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

[
    {
        "id": "my-app", 
        "instances": [
            {
                "host": "agouti.local", 
                "id": "my-app_0-1396592878455", 
                "ports": [
                    31759, 
                    31760
                ]
            }, 
            {
                "host": "agouti.local", 
                "id": "my-app_2-1396592890464", 
                "ports": [
                    31991, 
                    31992
                ]
            }, 
            {
                "host": "agouti.local", 
                "id": "my-app_3-1396592896470", 
                "ports": [
                    31938, 
                    31939
                ]
            }
        ], 
        "ports": [
            17753, 
            18445
        ]
    }
]
Example (as text)

Request:

GET /v1/endpoints HTTP/1.1
Accept: text/plain
Accept-Encoding: gzip, deflate, compress
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: text/plain
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

my-app_17753 17753 agouti.local:31991 agouti.local:31938 agouti.local:31759 
my-app_18445 18445 agouti.local:31992 agouti.local:31939 agouti.local:31760 

GET /v1/endpoints/{appId}

Example (as JSON)

Request:

GET /v1/endpoints/my-app HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "id": "my-app", 
    "instances": [
        {
            "host": "agouti.local", 
            "id": "my-app_0-1396592878455", 
            "ports": [
                31759, 
                31760
            ]
        }, 
        {
            "host": "agouti.local", 
            "id": "my-app_2-1396592890464", 
            "ports": [
                31991, 
                31992
            ]
        }, 
        {
            "host": "agouti.local", 
            "id": "my-app_3-1396592896470", 
            "ports": [
                31938, 
                31939
            ]
        }
    ], 
    "ports": [
        17753, 
        18445
    ]
}
Example (as text)

Request:

GET /v1/endpoints/my-app HTTP/1.1
Accept: text/plain
Accept-Encoding: gzip, deflate, compress
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: text/plain
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

my-app_17753 17753 agouti.local:31991 agouti.local:31938 agouti.local:31988 
my-app_18445 18445 agouti.local:31992 agouti.local:31939 agouti.local:31989 

Tasks

GET /v1/tasks

Example

Request:

GET /v1/tasks HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "my-app": [
        {
            "host": "agouti.local", 
            "id": "my-app_2-1396592951529", 
            "ports": [
                31994, 
                31995
            ]
        }, 
        {
            "host": "agouti.local", 
            "id": "my-app_3-1396592896470", 
            "ports": [
                31938, 
                31939
            ]
        }, 
        {
            "host": "agouti.local", 
            "id": "my-app_2-1396592939516", 
            "ports": [
                31988, 
                31989
            ]
        }
    ]
}

POST /v1/tasks/kill?appId={appId}&host={host}&id={taskId}&scale={true|false}

Example

Request:

POST /v1/tasks/kill?appId=my-app HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 0
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 404 Not Found
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

{
    "message": "No tasks matched your filters"
}

Debug

GET /v1/debug/isLeader

Example

Request:

GET /v1/debug/isLeader HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

true

GET /v1/debug/leaderUrl

Example

Request:

GET /v1/debug/leaderUrl HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Type: application/json; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.7.2


Response:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Jetty(8.y.z-SNAPSHOT)
Transfer-Encoding: chunked

agouti.local:8080