Automate

Automate

Make your phone or tablet smarter with automation

Get it on Google Play

HTTP request

An action block that performs a HTTP request, download content from the internet.

The fiber will pause until the download has completed.

The request content body and request content path can both be arrays thereof, the elements of both are interleaved beginning with body then file, body and so on. If only one array is used, or one is longer that the other, the (remaining) elements are simply concatenated. null elements are ignored. This can be used to concatenate files before upload, or send a multipart request, e.g. POST a web form which submit files. If the body is expected to be large, enable chunked transfer encoding by including a { "Transfer-Encoding": "chunked" } request header.

The save response controls if, and how the response content will be saved. If Save to file, then the path can be set to an existing or new file, or to a directory where the file will be placed with an automatic name. The path to the actual file downloaded is assigned to the response content variable. Avoid including an "Accept-Encoding" request header as that will explicitly disable automatic decompression of the response content, e.g. if it’s using gzip.

Always check the response status code to ensure an expected response, usually 200 for success. Use the Failure catch block to handle potential connection issue.

If an EACCES SocketException failure occurs, try disabling the system “Data Saver” feature, for just Automate or globally.

Note! Saving large responses to variable may cause performance issues since it can be included in the fiber when it’s stored in the internal database.

Input arguments

  • Request URLURL of content to download.
  • Request method — request method, default is GET, or POST when a body is supplied.
  • Request content typeMIME type of request content.
  • Request content body — request body content, either text, array or dictionary, default is no content.
  • Request content path — a file path, or array thereof, to include in request or to upload as body content, default is no file upload.
  • Basic authorization account — name of generic credentials account used for basic HTTP authorization, default is no authorization.
  • Request headers — a dictionary with additional request headers, use camel case for keys, e.g. "Content-Disposition".
  • Network interface — which network interface to connect through, default is the default data network interface (Android 5+)
  • Timeout — network interface availability, socket connect and socket read timeout, 0 for no timeout, default is 15 seconds.
  • Certificate — whether to trust insecure, self-signed, certificates.
  • Redirect — whether to not follow redirects, default is to follow redirects.
  • Save response — how to save response content, default is Don’t save.
  • Response path — file or directory path where the downloaded response content will be saved, default is a file in the “Download” directory.

Output variables

  • Response status code — variable to assign the response status code.
  • Response content — variable to assign the response content as text, or path to downloaded file.
  • Response headers — variable to assign a dictionary with the response headers.
Note! This documentation is also accessible within the app from Help & feedback menu.