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.

Output

  • 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.

  1. Drag the File Content field output from a Download card to the Multipart Upload card's File Content field.

  2. Drag the File Name field output from a Download card to the Multipart Upload card's File Name field.

  3. 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.

  1. From the Method dropdown, select POST.

  2. 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.

  1. In the Data section of the card, create a field and name it attributes.

  2. 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" }

See Also

Functions in Workflows

About the elements of Okta Workflows