# Report the web apps that keep going wrong

This function reports the web applications the scheduled health
check has had the most trouble with, worst first, with a breakdown
of what was wrong each time.

An account whose applications could not be read is named in
metadata.output.warnings and left out, rather than failing the
whole report: a partial answer that says so is more use than none.

Endpoint: GET /WebApp/flapping_apps
Version: 11.138.0.19
Security: BasicAuth

## Query parameters:

  - `days` (integer)
    How far back to look, in days.
    Example: 7

  - `limit` (integer)
    The greatest number of applications to name.
    Example: 20

## Response 200 fields (application/json):

  - `data` (object)

  - `data.apps` (array)
    The applications the health check has had the most
trouble with, worst first.

Ranked by restarts_recommended, then by
incidents, then by account and application name, so
the order is stable between calls. Empty when nothing is flapping, which
is the ordinary answer on a healthy server.

  - `data.apps.app` (string)
    The application's name (slug).
    Example: "my-app"

  - `data.apps.causes` (object)
    How many incidents there were of each cause.
Ten out-of-memory kills and ten unresolvable
domains are the same count and a different
problem, which is what this breakdown is for.
    Example: {"out_of_memory":6,"wedged":3}

  - `data.apps.domain` (string)
    The domain the application is bound to.
    Example: "my-app.example.com"

  - `data.apps.incidents` (integer)
    How many incidents were recorded for this application in the window.
    Example: 9

  - `data.apps.last_cause` (string)
    What was wrong the most recent time.
    Example: "out_of_memory"

  - `data.apps.last_seen` (string)
    When the most recent incident was recorded, in ISO 8601 format.
    Example: "2026-09-15T14:03:22.000Z"

  - `data.apps.restarts_recommended` (integer)
    How many of those incidents the health check
classified as wanting a restart, which is what
"flapping" means: the same application asking
to be repaired over and over. A domain that
does not resolve is a fault no restart would
fix, and is not counted.

A count of recommendations, not of restarts
made: an incident is recorded before anything
acts on it, and automatic recovery is off
unless an administrator turns it on.
    Example: 4

  - `data.apps.truncated` (integer)
    Whether this application has filled its incident
history, so incidents is a floor rather than a
total.

Each application keeps a bounded history, so
without this flag a badly flapping application
would be indistinguishable from one that
flapped exactly that many times.
    Enum: 0, 1

  - `data.days` (integer)
    The window the report covers, in days.
    Example: 7

  - `metadata` (object)

  - `metadata.command` (string)
    The method name called.
    Example: "flapping_apps"

  - `metadata.namespace` (string)
    The namespace used in the API call.
    Example: "WebApp"

  - `metadata.output` (object)
    Additional output from the API call.

  - `metadata.output.warnings` (array)
    The accounts whose web applications could not be
read, and why. Present only when there were any.

Such an account is left out of apps rather than
failing the whole report.

  - `metadata.reason` (string)
    The reason the API function failed when the metadata.result
field is 0. This field may display a success message when
a function succeeds.
    Example: "OK"

  - `metadata.result` (integer)
    * 1 - Success.
* 0 - Failed. Check the reason field for more details.
    Enum: 0, 1

  - `metadata.version` (integer)
    The version of the API function.
    Example: 1


