CapabilityStatusstatus=service.getStatus(Capability.DATASTORE_WRITE).getStatus();if(status==CapabilityStatus.DISABLED){// Datastore is in read-only mode.}
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eThe Capabilities API allows applications to detect outages and scheduled downtime for specific API capabilities, helping to minimize application downtime by bypassing unavailable services.\u003c/p\u003e\n"],["\u003cp\u003eThis API supports first-generation runtimes and can be utilized when upgrading to corresponding second-generation runtimes, with specific migration guidance provided for Java 11/17 runtimes.\u003c/p\u003e\n"],["\u003cp\u003eThe API returns an \u003ccode\u003eENABLED\u003c/code\u003e status for all services except "Datastore writes," which returns \u003ccode\u003eDISABLED\u003c/code\u003e when Datastore is in read-only mode.\u003c/p\u003e\n"],["\u003cp\u003eYou can query the availability of Datastore reads and writes separately, enabling you to handle read-only mode scenarios by displaying a custom message to users.\u003c/p\u003e\n"],["\u003cp\u003eThe API can verify the status of services like BLOBSTORE, Datastore, Images, Mail, Memcache, Task Queue, and URL Fetch, allowing for more fault-tolerant applications.\u003c/p\u003e\n"]]],[],null,["# Capabilities API for legacy bundled services\n\nWith the Capabilities API, your application can detect outages and scheduled\ndowntime for specific [API capabilities](#Supported_capabilities). You can use\nthis API to reduce downtime in your application by detecting when a capability\nis unavailable and then bypassing it. .\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| java-gen2\n|\n| /services/access). If you are updating to the App Engine Java 11/17 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/java-differences) to learn about your migration options for legacy bundled services.\n| Every status request to this API always returns `ENABLED` except\n| for the \"Datastore writes\" capability, which returns `DISABLED` if\n| Datastore is in read-only mode for your app.\n\nFor example, if you use the Images API to resize images, you can use the\nCapabilities API to detect when the Images API is unavailable and skip the\nresize: \n\n import com.google.appengine.api.capabilities.*;\n\n https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.capabilities.CapabilitiesService.html service =\n https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.capabilities.CapabilitiesServiceFactory.html.getCapabilitiesService();\n https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.capabilities.CapabilityStatus.html status = service.https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.capabilities.CapabilitiesService.html#com_google_appengine_api_capabilities_CapabilitiesService_getStatus_com_google_appengine_api_capabilities_Capability_(Capability.IMAGES).getStatus();\n\n if (status == https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.capabilities.CapabilityStatus.html.DISABLED) {\n // Images API is not available.\n }\n\nYou can separately query for the availability of Datastore reads and writes. The\nfollowing sample shows how to detect the availability of Datastore writes and,\nduring downtime, provide a message to users: \n\n CapabilityStatus status =\n service.getStatus(Capability.DATASTORE_WRITE).getStatus();\n\n if (status == CapabilityStatus.DISABLED) {\n // Datastore is in read-only mode.\n }\n\nUsing the Capabilities API in Java 8\n------------------------------------\n\nEach Capability is represented as a static constant on the Capability class,\nsuch as\n[`Capability.DATASTORE_WRITE`](/appengine/docs/legacy/standard/java/javadoc/com/google/appengine/api/capabilities/Capability#DATASTORE_WRITE).\nEach Capability has a state, which you can retrieve from\n[`CapabilitiesService.getStatus(Capability)`](/appengine/docs/legacy/standard/java/javadoc/com/google/appengine/api/capabilities/CapabilitiesService#getStatus-com.google.appengine.api.capabilities.Capability-).\nEach state has a status, which is an enumeration reflecting a the availability\nof a capability: either `ENABLED` or `DISABLED`. See below for the\n[list of services](#Supported_capabilities) currently enabled in this API.\n\nSupported capabilities\n----------------------\n\nThe API currently supports the following capabilities:"]]