Google App Engine

Capabilities Go API Overview

Python |Java |PHP |Go
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 Datastore API, you can use the Capabilities API to detect when the Datastore API is unavailable and report an error to the user:

func handler(w http.ResponseWriter, r *http.Request) {
    c := appengine.NewContext(r)
    if !capability.Enabled(c, "datastore_v3", "*") {
        http.Error(w, "This service is currently unavailable.", 503)
        return
    }
    // do Datastore lookup ...
}

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:

if !capability.Enabled(c, "datastore_v3", "write") {
    // Datastore is in read-only mode.
}

Using the Capabilities API in Go

The capability.Enabled function returns true if the provided API and capability are available. You must pass either a capability name (such as "write") or the wildcard "*" to query all capabilities of the API.

Supported capabilities

The API currently supports the following capabilities:

Capability Arguments to Enabled
Availability of the blobstore "blobstore", "*"
Datastore reads "datastore_v3", "*"
Datastore writes "datastore_v3", "write"
Availability of the Mail service "mail", "*"
Availability of the Memcache service "memcache", "*"
Availability of the Task Queue service "taskqueue", "*"
Availability of the URL Fetch service "urlfetch", "*"
Availability of the XMPP service "xmpp", "*"

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.