
Import files from web servers
🤖/http/import imports any file that is publicly available via a web URL into Transloadit.
The result of this Robot will carry a field import_url
in their metadata, which references the URL from which they were imported. Further conversion results that use this file will also carry this import_url
field. This allows you to to match conversion results with the original import URL that you used.
This Robot knows to interpret links to files on these services:
- Dropbox
- Google Drive
- Google Docs
- OneDrive
Instead of downloading the HTML page previewing the file, the actual file itself will be imported.
Parameters
-
use
String / Array of Strings / ObjectrequiredSpecifies which Step(s) to use as input.
-
You can pick any names for Steps except
":original"
(reserved for user uploads handled by Transloadit) -
You can provide several Steps as input with arrays:
"use": [ ":original", "encoded", "resized" ]
💡 That’s likely all you need to know about
use
, but you can view advanced use cases:› Advanced use cases
-
Step bundling. Some Robots can gather several Step results for a single invocation. For example, 🤖/file/compress would normally create one archive for each file passed to it. If you'd set
bundle_steps
to true, however, it will create one archive containing all the result files from all Steps you give it. To enable bundling, provide an object like the one below to theuse
parameter:"use": { "steps": [ ":original", "encoded", "resized" ], "bundle_steps": true }
This is also a crucial parameter for 🤖/video/adaptive, otherwise you'll generate 1 playlist for each viewing quality.
Keep in mind that all input Steps must be present in your Template. If one of them is missing (for instance it is rejected by a filter), no result is generated because the Robot waits indefinitely for all input Steps to be finished.Here’s a demo that showcases Step bundling.
-
Group by original. Sticking with 🤖/file/compress example, you can set
group_by_original
totrue
, in order to create a separate archive for each of your uploaded or imported files, instead of creating one archive containing all originals (or one per resulting file). This is important for for 🤖/media/playlist where you'd typically set:"use": { "steps": [ "segmented" ], "bundle_steps": true, "group_by_original": true }
-
Fields. You can be more discriminatory by only using files that match a field name by setting the
fields
property. When this array is specified, the corresponding Step will only be executed for files submitted through one of the given field names, which correspond with the strings in thename
attribute of the HTML file input field tag for instance. When using a back-end SDK, it corresponds withmyFieldName1
in e.g.:$transloadit->addFile('myFieldName1', './chameleon.jpg')
.This parameter is set to
true
by default, meaning all fields are accepted.Example:
"use": { "steps": [ ":original" ], "fields": [ "myFieldName1" ] }
-
Use as. Sometimes Robots take several inputs. For instance, 🤖/video/merge can create a slideshow from audio and images. You can map different Steps to the appropriate inputs.
Example:
"use": { "steps": [ { "name": "audio_encoded", "as": "audio" }, { "name": "images_resized", "as": "image" } ] }
Sometimes the ordering is important, for instance, with our concat Robots. In these cases, you can add an index that starts at 1. You can also optionally filter by the multipart field name. Like in this example, where all files are coming from the same source (end-user uploads), but with different
<input>
names:Example:
"use": { "steps": [ { "name": ":original", "fields": "myFirstVideo", "as": "video_1" }, { "name": ":original", "fields": "mySecondVideo", "as": "video_2" }, { "name": ":original", "fields": "myThirdVideo", "as": "video_3" } ] }
For times when it is not apparent where we should put the file, you can use Assembly Variables to be specific. For instance, you may want to pass a text file to 🤖/image/resize to burn the text in an image, but you are burning multiple texts, so where do we put the text file? We specify it via
${use.text_1}
, to indicate the first text file that was passed.Example:
"watermarked": { "robot": "/image/resize", "use" : { "steps": [ { "name": "resized", "as": "base" }, { "name": "transcribed", "as": "text" }, ], }, "text": [ { "text" : "Hi there", "valign": "top", "align" : "left", }, { "text" : "From the 'transcribed' Step: ${use.text_1}", "valign" : "bottom", "align" : "right", "x_offset": 16, "y_offset": -10, } ] }
-
-
url
String / Array of StringsrequiredThe URL from which the file to be imported can be retrieved.
You can also specify an array of URLs or a string of
|
delimited URLs to import several files at once. Please also check theurl_delimiter
parameter for that. -
url_delimiter
String ⋅ default:"|"
Provides the delimiter that is used to split the URLs in your
url
parameter value. -
headers
Array of Strings ⋅ default:[]
Custom headers to be sent for file import.
This is an empty array by default, such that no additional headers except the necessary ones (e.g. Host) are sent.
-
force_name
String / Array of Strings / Null ⋅ default:null
Custom name for the imported file(s). Defaults to
null
, which means the file names are derived from the supplied URL(s). -
ignore_errors
Array of Strings / Boolean ⋅ default:[]
Possible array members are
"meta"
and"import"
.You might see an error when trying to extract metadata from your imported files. This happens, for example, for files with a size of zero bytes. Including
"meta"
in the array will cause the Robot to not stop the import (and the entire Assembly) when that happens.Including
"import"
in the array will ensure the Robot does not cease to function on any import errors either.To keep backwards compatibility, setting this parameter to
true
will set it to["meta", "import"]
internally. -
import_on_errors
Array of Strings ⋅ default:[]
Possible array members are
"meta"
.Setting this to
"meta"
will still import the file on metadata extraction errors.ignore_errors
is similar, it also ignores the error and makes sure the Robot doesn't stop, but it doesn't import the file. -
fail_fast
Boolean ⋅ default:false
Disable the internal retry mechanism, and fail immediately if a resource can't be imported. This can be useful for performance critical applications.
Demos
- Fade effect between concatenated audio tracks
- Add watermark to a song
- Add an empty audio track to still video
- Encode a fade effect between concatenated video files.
- Generate a slideshow from a series of images
- Insert an ad into a video at a specific time
- Concatenate two audio files
- Insert cover art into an audio file
- Concatenate video files
- Generate a video from an image sequence
- Merge an audio and a video file
- Merge an audio file and an image to generate a video
Related blog posts
- Adding Support for Audio Encoding November 21, 2011
- Two Small Feature Updates February 11, 2012
- Last Night's Elevated Queue Times March 31, 2012
- Announcing the Assembly Notification System April 8, 2013
- API Updates and jQuery SDK Version 2.3.0 November 29, 2013
- New Robot for Virus Detection July 21, 2015
- Raising prices (for new customers) February 7, 2018
- Launching Turbo Mode in public beta November 15, 2018
- An introduction to the Subtitle Robot December 6, 2018
- Tutorial: Using /video/merge to develop video slideshows June 14, 2019
- Add real-time video uploading to a site without writing code, with Bubble.is and Transloadit August 2, 2019
- Let's Build: Spinning Vinyl GIF Generator April 1, 2021
- Convert Markdown to HTML (and PDF) April 19, 2021
- Fast failing for the /http/import Robot June 1, 2021
- Let's Build: a video from album art October 10, 2021
- Transloadit Milestones of 2021 January 31, 2022
- Let's Build: Reddit video subtitling bot February 10, 2022
- Let's Build: Music Card Generator May 5, 2022