URLExecute
URLExecute[url]
executes the specified URL, importing whatever result is generated.
URLExecute[url,{"param1"val1,"param2"val2,…}]
executes the specified URL, adding elements with names parami and values vali.
URLExecute[url,params,format]
imports the result using the specified format.
URLExecute[CloudObject[…],…]
executes a cloud object with current authentication settings.
URLExecute[HTTPRequest[…],…]
executes the specified HTTP request.
Details and Options
- In URLExecute[url], url can be a string, a URL object, or a cloud object.
- URLExecute[assoc] is equivalent to URLExecute[HTTPRequest[assoc]].
- For simple forms of the vali such as numbers and short strings, URLExecute 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, … image an image in default format ExportForm[expr,form] any expression, exported in the specified form File["file"] the contents of a file - URLExecute supports the following options:
-
Authentication Automatic authentication information to send CharacterEncoding Automatic character encoding for strings sent CookieFunction Automatic function to apply to each cookie received FollowRedirects True whether to follow HTTP redirects Interactive True whether to allow interactive authentication dialogs TimeConstraint Infinity time to wait for a response VerifySecurityCertificates True whether to verify SSL security certificates - The setting CharacterEncoding->"enc" specifies that all strings that appear in the request should be encoded using the encoding enc before being sent to the server.
- The setting CharacterEncoding->None specifies that no change should be made to strings before sending them to the server.
- With CharacterEncoding->Automatic, the encoding is taken from the "ContentType" element if this is specified; otherwise, the encoding is "UTF8".
- 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.
- URLExecute[url] and URLExecute[url,params] import the result from the URL, automatically determining the format to use. JSON is by default imported in "JSON" format.
- In URLExecute[url,params,format], format can be any format supported by Import.
Examples
open allclose allBasic Examples (5)
Execute a URL and import the result from a JSON API:
Execute picsum API and import the result as an image:
Create a deck of cards on http://deckofcardsapi.com:
Draw four cards from this deck:
Execute an APIFunction:
URL objects can be used:
Options (4)
TimeConstraint (1)
Text
Wolfram Research (2014), URLExecute, Wolfram Language function, https://reference.wolfram.com/language/ref/URLExecute.html (updated 2016).
CMS
Wolfram Language. 2014. "URLExecute." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/URLExecute.html.
APA
Wolfram Language. (2014). URLExecute. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/URLExecute.html