Remote input type
The following code specifies a remote input file provided via URL:
{
"input": [{
"type": "remote",
"source": "https://example-files.online-convert.com/raster%20image/png/example_small.png"
}]
}
This is the simplest way of specifying an input file. Define the type
field as remote
and specify the URL of the file you want to convert in
the source
.
Password protected files
If the input is a password protected file (e.g. pdf, zip, ...) you can specify this as following:
{
"input": [{
"type": "remote",
"source": "https://example-files.online-convert.com/document/pdf/example_multipage_protected.pdf",
"credentials": {
"decrypt_password": "online-convert.com"
}
}]
}
It is also possible to send just the remote input like in the first example and adding the password in a second step. This is done by simply sending a PATCH request to the following endpoint:
/jobs/<job_id>/input/<input_id>
For this, use the following content:
{
"credentials": {
"decrypt_password": "my_password"
}
}
In order to patch the input, the job should not be started yet. This means it should be created using
{"process": false}
User suggested filenames
In some use cases it might be desirable to specify the name of the output file instead of using the original file name.
One such example is to rename image files with a generic name like DSC_0013.JPG to a more meaningful name like Holiday 2018_0013.png during the conversion.
A different example are dynamically generated urls like ?productId=ABC123 in which case the output filename can be set to e.g. Product ABC123 Manual.pdf.
In order to specify the new filename you have to send the file like in the folowing example:
{
"input": [{
"filename": "Product ABC123 Manual.pdf",
"type": "remote",
"source": "https://www.example.com/your_dynamic_url?productId=ABC123"
}]
}
If you are unsure about the format of your file, just send the name without the extension. It will automatically be added by us.
Specify a remote download engine
Depending on the remote input URL and on the desired target, we do our best to guess what the expected result will be like. Sometimes our best guess is not as you may expect for your specific needs. Thus, you can specify a different remote download engine that fits your task better. Consider the example below:
{
"input": [{
"type": "remote",
"source": "https://www.example.com/your_dynamic_url?productId=ABC123",
"engine": "screenshot"
}]
}
The possible values for the engine are shown in the following table:
engine | description |
---|---|
auto | We do our best to choose the best engine to download the remote content for your conversion |
file | The remote URL is considered as a single file with its own filename and extension |
screenshot | Use this engine when what you need is a screenshot of a remote web page |
website | When you need all the files that are used to render the remote web page |
screenshot_pdf | This engine downloads a website as PDF document |
As to better understand the different results that you may expect from the various engines, let's assume that you have a dynamic URL like the one in the example above. If this source URL displays a full web page with the picture, description, and price of the requested productId, you may select screenshot as your engine. You will then receive an image/screenshot of the web page. If you are interested in the full source code of the web page with all the assets, you should select website. If the link points you directly to a PDF document for the product, file or simply auto will probably be the best choice.