window.fetch(input, [init])
Fetches a resource from the network.
Returns: Promise<Response> Promise that resolves to a Response object.
Throws:
TypeErrorIf init.body is set and init.method is either "GET" or "HEAD".TypeErrorIf either network error or network time-out occurs after a http request is made.TypeErrorIf there is a failure in reading files in FormData during posting FormData. <br></br> In order to leveragefetch, update themanifest.jsonwith thenetwork.domainspermission shown below. <b>Example:</b>
{
"permissions": {
"network": {
"domains": [
"https://www.adobe.com",
"https://*.adobeprerelease.com",
"wss://*.myplugin.com"
]
}
}
}
<b>Limitation:</b> From UXP v7.4.0 onwards permissions.network.domains does not support WildCards in top-level domains. <b>Example:</b>
"domains": [ "https://www.adobe.*", "https://www.*" ]
See: Headers, Request and Response
Param
Type
Description
input
string | RequestEither the URL string to connect with or a Request object having the URL and the init option.
[init]
Object(Optional) Custom settings for a HTTP request.[init.method]
stringHTTP request method. The default value is "GET".
[init.headers]
HeadersHTTP request headers to add.
[init.body]
string | ArrayBuffer | TypedArray | Blob | FormData | URLSearchParamsBody to add to HTTP request.
[init.credentials]
stringIndicates whether to send cookies. The default value is "include". Possible values and functions are as follows: <ul style="list-style: none;"> <li>"omit" : cookies are NOT sent.</li> <li>"include" : cookies are sent.</li> </ul>