URLDownloadSubmit

URLDownloadSubmit[url, file]

submits the specified URL to be downloaded asynchronously to the file given.

URLDownloadSubmit[url,file,{"param1"val1,"param2"val2,}]

submits the specified URL, adding elements with names parami and values vali.

URLDownloadSubmit[obj,]

submits the cloud object obj.

URLDownloadSubmit[HTTPRequest[],]

submits the specified HTTP request.

Details and Options

  • In URLDownloadSubmit[url,], url can be a string, a URL object or a cloud object.
  • URLDownloadSubmit[assoc] is equivalent to URLDownloadSubmit[HTTPRequest[assoc]].
  • URLDownloadSubmit returns a symbolic representation of an asynchronous task.
  • URLDownloadSubmit takes the following options:
  • AuthenticationNoneauthentication information to send
    CharacterEncodingAutomaticcharacter encoding for the request
    CookieFunction Automaticfunction to apply to each cookie received
    FollowRedirectsTruewhether to follow HTTP redirects
    HandlerFunctions<||>how to handle events generated
    HandlerFunctionsKeysAutomaticwhat parameters to supply to handler functions
    TimeConstraintInfinitytime to wait for a response
    VerifySecurityCertificatesTruewhether to verify SSL security certificates
  • TimeConstraint->t allows a maximum of t seconds for connection to the URL and reading from it.
  • TimeConstraint-><|"Connecting"->tc,"Reading"->tr|> specifies separate timeouts for connecting to the URL and reading from it.
  • During the asynchronous execution of URLDownloadSubmit, the following events can be generated:
  • "ConnectionFailed"URL connection failed
    "CookiesReceived"cookies successfully received
    "HeadersReceived"headers successfully received
    "TaskFinished"task finished
    "TaskProgress"task has made measurable progress
    "TaskStatusChanged"status of task changes
  • With the specification HandlerFunctions-><|,"eventi"->fi,|>, fi[assoc] is evaluated whenever eventi is generated. The elements of assoc have keys specified by the setting for HandlerFunctionsKeys.
  • Possible keys specified by HandlerFunctionsKeys include:
  • "Headers"list of headers received in the response
    "Cookies"list of cookies received in the response
    "ContentType"content type header
    "StatusCode"status code returned by the server
    "StatusCodeDescription"plain text description of status code
    "File"loacation of downloaded contents
    "ByteCountDownloaded"number of bytes downloaded so far
    "ByteCountTotal"total number of bytes to download
    "FractionComplete"fraction of total downloaded so far
    "Task"the task object generated by URLDownloadSubmit
    "TaskStatus""Running", "Suspended", "Finished"
    "TaskType"type of the task
    "TaskUUID"unique task identifier
    "EventName"the name of the event being handled
  • Values that have not yet been received are given as Missing["NotAvailable"].
  • If the appropriate headers are not available at the downloaded URL, "ByteCountTotal" and "FractionComplete" will be given as Missing["NotAvailable"].
  • When parameters are given, for simple forms of the values vali such as numbers and short strings, URLDownloadSubmit performs a GET request, with the parami specifying parameters in the query string. In other cases, it performs a POST request.
  • The vali can be strings or numbers, or the following special forms:
  • None,Null,Missing""
    True"true"
    False"false"
    {e1,e2,}e1, e2,
    imagean image in default format
    ExportForm[expr,form]any expression, exported in the specified form
    File["file"]the contents of a file

Examples

open allclose all

Basic Examples  (5)

Send a request and get notified when the task finishes:

Send a request with parameters:

Get the status code and content type:

Build a URL from components:

More complex requests can use HTTPRequest:

Scope  (4)

Receive the body of the response as a string:

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

Receive the body of the response as a ByteArray:

Receive a notification when the task finishes:

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

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

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

Get status code for a resource that does not exist:

Options  (1)

CookieFunction  (1)

Properties & Relations  (2)

URL and CloudObject are fully supported:

Use URLRead to perform a synchronous request:

Use URLDownloadSubmit to assign the variable asynchronously:

Wolfram Research (2017), URLDownloadSubmit, Wolfram Language function, https://reference.wolfram.com/language/ref/URLDownloadSubmit.html.

Text

Wolfram Research (2017), URLDownloadSubmit, Wolfram Language function, https://reference.wolfram.com/language/ref/URLDownloadSubmit.html.

CMS

Wolfram Language. 2017. "URLDownloadSubmit." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/URLDownloadSubmit.html.

APA

Wolfram Language. (2017). URLDownloadSubmit. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/URLDownloadSubmit.html

BibTeX

@misc{reference.wolfram_2024_urldownloadsubmit, author="Wolfram Research", title="{URLDownloadSubmit}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/URLDownloadSubmit.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_urldownloadsubmit, organization={Wolfram Research}, title={URLDownloadSubmit}, year={2017}, url={https://reference.wolfram.com/language/ref/URLDownloadSubmit.html}, note=[Accessed: 21-November-2024 ]}