Capabilities API for legacy bundled services

With the Capabilities API, your application can detect outages and scheduled downtime for specific API capabilities. You can use this API to reduce downtime in your application by detecting when a capability is unavailable and then bypassing it. .

For example, if you use the Images API to resize images, you can use the Capabilities API to detect when the Images API is unavailable and skip the resize:

import com.google.appengine.api.capabilities.*;

CapabilitiesService service =
    CapabilitiesServiceFactory.getCapabilitiesService();
CapabilityStatus status = service.getStatus(Capability.IMAGES).getStatus();

if (status == CapabilityStatus.DISABLED) {
    // Images API is not available.
}

You can separately query for the availability of Datastore reads and writes. The following sample shows how to detect the availability of Datastore writes and, during downtime, provide a message to users:

CapabilityStatus status =
    service.getStatus(Capability.DATASTORE_WRITE).getStatus();

if (status == CapabilityStatus.DISABLED) {
    // Datastore is in read-only mode.
}

Using the Capabilities API in Java 8

Each Capability is represented as a static constant on the Capability class, such as Capability.DATASTORE_WRITE. Each Capability has a state, which you can retrieve from CapabilitiesService.getStatus(Capability). Each state has a status, which is an enumeration reflecting a the availability of a capability: either ENABLED or DISABLED. See below for the list of services currently enabled in this API.

Supported capabilities

The API currently supports the following capabilities:

Capability Arguments to getStatus
Availability of the blobstore Capability.BLOBSTORE
Datastore reads Capability.DATASTORE
Datastore writes Capability.DATASTORE_WRITE
Availability of the Images service Capability.IMAGES
Availability of the Mail service Capability.MAIL
Availability of the Memcache service Capability.MEMCACHE
Availability of the Task Queue service Capability.TASKQUEUE
Availability of the URL Fetch service Capability.URL_FETCH