Download the converted file

Once we know the job has been completed successfully it's time to download the result.

If you take a closer look at the data returned by the API when a job is completed, you will see an output key that will be populated with data related to the result of the conversion.

Take the uri key of each output that is present and do a GET request to download it.

{
    "id": "xxxxxxx-6f8b-4b3b-b67e-150c407614b8",
    "token": "xxxxxxx0ce224701563837758ced469a",
    "type": "job",
    "status": {
        "code": "completed",
        "info": "The file has been successfully converted."
    },
    "errors": [],
    ... extra information ...
    "output": [
        {
            "id": "xxxxxxx-46fd-4e3c-826b-db01a140dea0",
            "source": {
                "conversion": "xxxxxxx-8932-4aa8-b66c-114995edd980",
                "input": [
                    "xxxxxxx-ecb6-4ddb-b713-e314125a536e"
                ]
            },
            "uri": "https://www13.online-convert.com/dl/web2/download-file/xxxxxxx-6f8b-4b3b-b67e-150c407614b8/example_small.png",
            "size": 99101,
            "status": "enabled",
            "content_type": "image/png",
            "downloads_counter": 0,
            "checksum": "33eeb8844313b7f381f844eca40ae687",
            "created_at": "2017-08-15T17:33:05"
        }
    ],
    ... extra information ...
}
GET /dl/web2/download-file/xxxxxxx-6f8b-4b3b-b67e-150c407614b8/example_small.png HTTP/1.1
Host: www13.online-convert.com
Cache-Control: no-cache
curl -o example_small.png -X GET \
  https://www13.online-convert.com/dl/web2/download-file/xxxxxxx-6f8b-4b3b-b67e-150c407614b8/example_small.png \
  -H 'cache-control: no-cache'

There are several status possible for the "output" according to whether e.g. it is still available, was deleted. Possible status values are:

Status Description
enabled The file can be downloaded.
disabled The file was deleted.
expired The file is no longer available on our servers. Files are available for 24h.
overuse The file was already downloaded too often for the maximum allowed downloads value which is typically 10.

results matching ""

    No results matching ""