Jump to a Section
  • Download

    Download a file to the Workflows file system over HTTP or HTTPS.  You can use this function to download any file that you can access through a URL in your browser (such as an image or a document file).

    NOTE: File functions does not support shareable links such as those from Box, OneDrive, or Google Drive.

    Input Fields

    • URL (text): URL of the request, including the protocol http:// or https://
    • Headers (text): user-created fields to define headers to use in the file request
    • Query (text): user-created fields to define query parameters to use in the file request

    Output Fields

    • File Content (file): ID of the file contents
    • Filename (text): filename of the downloaded file
    • Size (number): size of the downloaded file, in bytes

    Use Download Function

    To use this function:
    1. Enter the URL, including the http:// or https:// part, in the URL field.
    2. Optionally, use the Query section to build a query string.
    For example, if you wanted to download a file from https://www.example.com/download?filename=foo.txt, then you express this in one of two ways:

    • you could put that whole string into the URL input; or.
    • you could set the URL to https://www.example.com/download, create an input filename in the Query section, and enter a value of foo.txt. This method is easier when the value of filename comes from a previous step in the Flow. You can drag the field into the input.
    1. Optionally, set headers in the request.
      For example if the site requires authorization, you could add a header “Authorization: Bearer my-token” by adding an Authorization key to the Headers section and setting its value to Bearer my-token.  You can also set “Content-type: application/image” similarly.
    2. Optionally, drag the ID value from the File Content output field to the File input of another card, such as a Box upload card.
  • Info

    Retrieves information about a file.  To use it, set the File Content field of a file you have downloaded previously in the Flow as your input. The output of this card will give you helpful information about that file.

    Input Fields

    • File Content (file): identifier of the file contents

    Output Fields

    • Filename (text):  filename of the downloaded file
    • Extension (text):  extension of the file name, which (often) defines the file type - e.g. .jpg, .png, .csv, etc.
    • Size (number):  size of the file, in bytes
    • Created (date):  date/time that the file was created
    • Updated (date):  date/time that the file was updated

    Example

    Here’s an example of a successful execution, showing a jpeg file downloaded from Google Images:

  • Multipart Upload

    Uploads a file from the the software’s filesystem to a web service, using http or https, via multipart form-data. Please consider the api you will be be using to fetch the required input field data.

    The output is dependent on the response from the service.  To access a particular response properly, create an output with the same name as the key in the response object.

    NOTE: File functions does not support shareable links such as those from Box, OneDrive, or Google Drive.

    Options

    • Use Custom File Parameter (yes/no): indicates whether you want to use custom file parameters

    Input Fields

    • File  File Content (file): ID of the file contents to upload. If you’re using a test function, then you can choose a file to upload File Name (string): file name, including the extension
    • Http
      • URL (text): URL of the request, including the protocol http:// or https://
      • Method (text): http method to use (PUT or POST).
      • Headers (text): user-created fields (text) to define headers to use in the file request
    • Data
      • input: file attributes of the file, such as file ID and file name

    Output Fields

    • Body (text): response body that’s been parsed for JSON properties or values
    • Raw Body (text): raw response body that was passed at runtime

    Example

    In this example, you upload a file to Box:
    1. In the Use Custom File Parameter dropdown, select No.

    This option will allow you to specify one or more custom inputs and define their names. The values can be passed at runtime, and these properties and values will be included in the multipart body of the message.
    2. Drag the File Content field output from a Download card to the Multipart Upload card’s File Content field.
    3. Drag the File Name field output from a Download card to the Multipart Upload card’s File Name field.
    4. Add a URL as the destination of the uploaded file.
    Include the http:// or https:// part, and any query string parameters, in the URL input.
    5. From the Method dropdown, select POST.
    6. Pass an authorization bearer token as a header into the Header field.
    For example, add a header “Authorization: Bearer my-token” by adding an Authorization key to the Headers section and setting its value to Bearer my-token.  You can also set “Content-type: application/image” similarly.
    7. In the Data section of the card, create a field and name it attributes.
    8. Pass a JSON object that supplies the attributes of the file (folder ID and file name). The file must already be in the Workflows file system. For example:
    { "parent": { "id": "108297462713" }, "name": "humans.txt" }

  • Upload

    Upload a file from the Workflows file system to a web service using HTTP or HTTPS.

    NOTE: File functions does not support shareable links such as those from Box, OneDrive, or Google Drive.

    Input Fields

    • File Content (file): the ID of the file contents to upload
    • URL (text): the URL of the request, including the protocol http:// or https://
    • Method (dropdown): http method to use (PUT or POST)
    • Headers (text): user-created fields to define headers to use in the file request

    Output Fields

    • Body (text): response body that’s been parsed for JSON properties or values
    • Raw Body (text): raw response body that was passed at runtime

    Use Upload Function

    To use this function:
    1. Identify the file to upload by dragging an existing File type (typically called File Contents) from a previous card in the Flow. For example, use file contents from a download card from another cloud service.
    1. Specify the URL, including the http:// or https:// part and any query string parameters, in the URL input.
    1. Select the HTTP method - PUT or POST - and set any headers required by the service.
    Typically, there will be one or more headers required, especially for authentication.
    For example, if the site requires authorization, you could add a header “Authorization: Bearer my-token” by adding an Authorization key to the Headers section and setting its value to Bearer my-token.  You can also set “Content-type: application/image” similarly.

    The output is dependent on the response from the service.  To access a particular response properly, create an output with the same name as the key in the response object.

    Example

    Here is an example of accessing the Algorithmia file system. Algorithmia requires that the full file path and filename of the destination file be specified in the URL. It also requires an authentication token (replace that with a real one) and a specific Content-Type.