({{, (RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit])[url, file]
submits the specified URL to be downloaded asynchronously to the file given.}, {, (RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit])[url,file,{"(Subscript[param, 1])"->(Subscript[val, 1]),"(Subscript[param, 2])"->(Subscript[val, 2]),…}] 
submits the specified URL, adding elements with names (Subscript[param, i]) and values (Subscript[val, i]). }, {, (RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit])[obj,…]
submits the cloud object obj.}, {, (RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit])[(RefLink[HTTPRequest, paclet:ref/HTTPRequest])[…],…]
submits the specified HTTP request.}})

OpenersNotesSection(Spacer1)Details and Options

In (RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit])[url,…], url can be a string, a URL object or a cloud object.

(RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit])[assoc] is equivalent to (RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit])[(RefLink[HTTPRequest, paclet:ref/HTTPRequest])[assoc]].

(RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit]) returns a symbolic representation of an asynchronous task.

(RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit]) takes the following options:

(RefLink[TimeConstraint, paclet:ref/TimeConstraint])->t allows a maximum of t seconds for connection to the URL and reading from it.

(RefLink[TimeConstraint, paclet:ref/TimeConstraint])-><|"Connecting"->(Subscript[t, c]),"Reading"->(Subscript[t, r])|> specifies separate timeouts for connecting to the URL and reading from it.

During the asynchronous execution of (RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit]), the following events can be generated:

With the specification (RefLink[HandlerFunctions, paclet:ref/HandlerFunctions])-><|…,"(Subscript[event, i])"->(Subscript[f, i]),…|>, (Subscript[f, i])[assoc] is evaluated whenever (Subscript[event, i]) is generated. The elements of assoc have keys specified by the setting for (RefLink[HandlerFunctionsKeys, paclet:ref/HandlerFunctionsKeys]).

Possible keys specified by (RefLink[HandlerFunctionsKeys, paclet:ref/HandlerFunctionsKeys]) include:

Values that have not yet been received are given as (RefLink[Missing, paclet:ref/Missing])["NotAvailable"].

If the appropriate headers are not available at the downloaded URL, "ByteCountTotal" and "FractionComplete" will be given as (RefLink[Missing, paclet:ref/Missing])["NotAvailable"].

When parameters are given, for simple forms of the values (Subscript[val, i]) such as numbers and short strings, (RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit]) performs a GET request, with the (Subscript[param, i]) specifying parameters in the query string. In other cases, it performs a POST request.

The (Subscript[val, i]) can be strings or numbers, or the following special forms:

OpenersPrimaryExamplesSection(Spacer1)Examples  (12)

OpenersExampleSection0(Spacer1)Basic Examples  (5)

Send a request and get notified when the task finishes:

URLDownloadSubmit["http://www.wolfram.com",CreateFile[],HandlerFunctions-><|"TaskFinished"->Print|>]

Send a request with parameters:

URLDownloadSubmit["http://www.wolframalpha.com",CreateFile[],{"i"->"200 usd in eur"},HandlerFunctions-><|"TaskFinished"->Print|>]

Get the status code and content type:

URLDownloadSubmit["http://www.wolfram.com",CreateFile[],HandlerFunctions-><|"TaskFinished"->Print|>, HandlerFunctionsKeys->{"StatusCode", "ContentType"}]

Build a URL from components:

URLDownloadSubmit[<|"Scheme"->"http","Domain"->"www.wolframalpha.com","Query"->{"i"->"200 usd in eur"}|>,CreateFile[],HandlerFunctions-><|"HeadersReceived"->Print|>]

More complex requests can use (RefLink[HTTPRequest, paclet:ref/HTTPRequest]):

URLDownloadSubmit[HTTPRequest[<|"Scheme"->"http","Domain"->"www.wolframalpha.com","Query"->{"i"->"200 usd in eur"}|>],CreateFile[],HandlerFunctions-><|"HeadersReceived"->Print|>]

OpenersExampleSection1(Spacer1)Scope  (4)

Receive the body of the response as a string:

URLDownloadSubmit["http://www.wolfram.com",CreateFile[],HandlerFunctions-><|"BodyReceived"->Print|>, HandlerFunctionsKeys->{"Body"}]

Receive the body of the response as a list of bytes:

URLDownloadSubmit["http://www.wolfram.com",CreateFile[],HandlerFunctions-><|"BodyReceived"->Print|>, HandlerFunctionsKeys->{"BodyBytes"}]

Receive the body of the response as a (RefLink[ByteArray, paclet:ref/ByteArray]):

URLDownloadSubmit["http://www.wolfram.com",CreateFile[],HandlerFunctions-><|"BodyReceived"->Print|>, HandlerFunctionsKeys->{"BodyByteArray"}]

Receive a notification when the task finishes:

URLDownloadSubmit["http://www.wolfram.com",CreateFile[],HandlerFunctions-><|"TaskFinished"->Print|>]

Receive cookies, headers and task status when the task status changes:

URLDownloadSubmit["http://www.wolfram.com",CreateFile[],HandlerFunctions-><|"TaskStatusChange"->Print|>, HandlerFunctionsKeys->{"Cookies","Headers","TaskStatus"}]

Get the status code and description when the headers are received:

URLDownloadSubmit["http://www.wolfram.com",CreateFile[],HandlerFunctions-><|"HeadersReceived"->Print|>, HandlerFunctionsKeys->{"ContentType"}]

Get the status code and description when the headers are received:

URLDownloadSubmit["http://www.wolfram.com",CreateFile[],HandlerFunctions-><|"HeadersReceived"->Print|>, HandlerFunctionsKeys->{"StatusCode","StatusCodeDescription"}]

Get status code for a resource that does not exist:

URLDownloadSubmit["https://www.wolframcloud.com/objects/foo",CreateFile[],HandlerFunctions-><|"HeadersReceived"->Print|>, HandlerFunctionsKeys->{"StatusCode","StatusCodeDescription"}]

OpenersExampleSection2(Spacer1)Options  (1)

OpenersExampleSubsection0(Spacer1)CookieFunction  (1)

ClearCookies[All];

URLDownloadSubmit["http://www.wolfram.com",CreateFile[],CookieFunction->Print]

OpenersExampleSection3(Spacer1)Properties & Relations  (2)

(RefLink[URL, paclet:ref/URL]) and (RefLink[CloudObject, paclet:ref/CloudObject]) are fully supported:

URLDownloadSubmit[URL["http://www.wolfram.com"],CreateFile[],{"i"->"200 usd in eur"},HandlerFunctions-><|"TaskFinished"->Print|>]

URLDownloadSubmit[CloudObject[],CreateFile[],HandlerFunctions-><|"HeadersReceived"->Print|>]

Use (RefLink[URLRead, paclet:ref/URLRead]) to perform a synchronous request:

headers=URLRead["http://www.wolfram.com","Headers"]

Use (RefLink[URLDownloadSubmit, paclet:ref/URLDownloadSubmit]) to assign the variable asynchronously:

URLDownloadSubmit["http://www.wolfram.com",CreateFile[],HandlerFunctions-><|"HeadersReceived"->((headers=#Headers)&)|>]

headers

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[URLDownload, paclet:ref/URLDownload])  ▪  (RefLink[URLSubmit, paclet:ref/URLSubmit])  ▪  (RefLink[URLExecute, paclet:ref/URLExecute])  ▪  (RefLink[URLRead, paclet:ref/URLRead])  ▪  (RefLink[HTTPRequest, paclet:ref/HTTPRequest])  ▪  (RefLink[HTTPResponse, paclet:ref/HTTPResponse])  ▪  (RefLink[SocketConnect, paclet:ref/SocketConnect])  ▪  (RefLink[SocketListen, paclet:ref/SocketListen])  ▪  (RefLink[TaskSuspend, paclet:ref/TaskSuspend])  ▪  (RefLink[TaskAbort, paclet:ref/TaskAbort])  ▪  (RefLink[TaskRemove, paclet:ref/TaskRemove])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Background & Scheduled Tasks, paclet:guide/BackgroundAndScheduledTasks])}, {▪(RefLinkPlain[HTTP Requests & Responses, paclet:guide/HTTPRequestsAndResponses])}, {▪(RefLinkPlain[Web Operations, paclet:guide/WebOperations])}})}})