Stay organized with collections
Save and categorize content based on your preferences.
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. To view the contents of
the capability package, see the
capability package reference.
.
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:
funchandler(whttp.ResponseWriter,r*http.Request){ctx:=appengine.NewContext(r)// Check if the Datastore API is availableif!capability.Enabled(ctx,"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:
funccheckDatastoreMode(whttp.ResponseWriter,r*http.Request){ctx:=appengine.NewContext(r)// Check if the Datastore service is in read-only mode.if!capability.Enabled(ctx,"datastore_v3","write"){// Datastore is in read-only mode.}}
Using the Capabilities API in Go 1.11
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:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-01 UTC."],[[["The Capabilities API allows applications to detect outages and scheduled downtime for specific API capabilities, helping to reduce downtime by identifying when a capability is unavailable and bypassing it."],["This API is designed for first-generation runtimes and remains usable when upgrading to corresponding second-generation runtimes, although those upgrading to Go 1.12+ should consult the migration guide."],["The `capability.Enabled` function verifies the availability of a given API and capability, and requires a capability name like `\"write\"` or the wildcard `\"*\"` for querying all API capabilities."],["Datastore writes are the only exception to the usual behavior, with the API returning `DISABLED` when Datastore is in read-only mode, whereas other statuses return `ENABLED`."],["Supported capabilities include the availability of the blobstore, Datastore reads and writes, Mail service, Memcache service, Task Queue service, and URL Fetch service."]]],[]]