System property to turn on server certificate validation by default. The value of the property
should be the string "true" in order to enable validation.
If request.getMethod is not
supported by the URLFetchService.
fetch(URL url)
publicabstractHTTPResponsefetch(URLurl)
Convenience method for retrieving a specific URL via a HTTP GET
request with no custom headers and default values for all
FetchOptions attributes. For more complex requests, use
#fetch(HTTPRequest).
Convenience method for asynchronously retrieving a specific URL
via a HTTP GET request with no custom headers and default values
for all FetchOptions attributes. For more complex
requests, use #fetchAsync(HTTPRequest).
[[["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-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eURLFetchService\u003c/code\u003e allows user code to send HTTP requests to external URLs, with all content returned in a single block, as it does not support chunked or hanging requests.\u003c/p\u003e\n"],["\u003cp\u003eThe service offers both synchronous and asynchronous methods, \u003ccode\u003efetch\u003c/code\u003e and \u003ccode\u003efetchAsync\u003c/code\u003e, for executing requests, allowing fetching via either a complete \u003ccode\u003eHTTPRequest\u003c/code\u003e or simply a \u003ccode\u003eURL\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDEFAULT_DEADLINE_PROPERTY\u003c/code\u003e is a system property that allows defining a global default deadline for URLFetch operations.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDEFAULT_TLS_VALIDATION_PROPERTY\u003c/code\u003e is a system property that enables server certificate validation by default when its value is set to \u003ccode\u003e"true"\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eUsing the \u003ccode\u003efetch\u003c/code\u003e methods, a user can either provide a specific \u003ccode\u003eHTTPRequest\u003c/code\u003e for customized requests, or just a URL for a basic HTTP GET request with default settings.\u003c/p\u003e\n"]]],[],null,["# Interface URLFetchService (2.0.0)\n\n public interface URLFetchService\n\nThe `URLFetchService` provides a way for user code to execute\nHTTP requests to external URLs.\n\nChunked and hanging requests are not supported, and all content\nwill be returned in a single block.\n\nStatic Fields\n-------------\n\n### DEFAULT_DEADLINE_PROPERTY\n\n public static final String DEFAULT_DEADLINE_PROPERTY\n\nSystem property for defining a global default URLFetch deadline.\n\n### DEFAULT_TLS_VALIDATION_PROPERTY\n\n public static final String DEFAULT_TLS_VALIDATION_PROPERTY\n\nSystem property to turn on server certificate validation by default. The value of the property\nshould be the string `\"true\"` in order to enable validation.\n\nMethods\n-------\n\n### fetch(HTTPRequest request)\n\n public abstract HTTPResponse fetch(HTTPRequest request)\n\nExecute the specified request and return its response.\n\n### fetch(URL url)\n\n public abstract HTTPResponse fetch(URL url)\n\nConvenience method for retrieving a specific URL via a HTTP GET\nrequest with no custom headers and default values for all\n[FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) attributes. For more complex requests, use\n[#fetch(HTTPRequest)](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.URLFetchService#com_google_appengine_api_urlfetch_URLFetchService_fetch_com_google_appengine_api_urlfetch_HTTPRequest_).\n\n### fetchAsync(HTTPRequest request)\n\n public abstract Future\u003cHTTPResponse\u003e fetchAsync(HTTPRequest request)\n\nAsynchronously execute the specified request and return its response.\n\n### fetchAsync(URL url)\n\n public abstract Future\u003cHTTPResponse\u003e fetchAsync(URL url)\n\nConvenience method for asynchronously retrieving a specific URL\nvia a HTTP GET request with no custom headers and default values\nfor all [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) attributes. For more complex\nrequests, use [#fetchAsync(HTTPRequest)](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.URLFetchService#com_google_appengine_api_urlfetch_URLFetchService_fetchAsync_com_google_appengine_api_urlfetch_HTTPRequest_)."]]