Batch File Conversion – How To Convert Multiple Files Via API

API
Image by http://bit.ly/1Qbb7Rr

Wouldn’t it be wonderful if you could convert several files all at once?

This is actually possible using the API of online-convert.com! Using the API and the Postman app, developers but private people as well can convert many files at once. This process is called batch conversion and in this blog article, we will show you how to do this!

 

More about the online-Convert.com API:

 

How To Perform Batch Conversion

In order for you to convert a whole batch of files at once, you should be familiar with the basics of using our API and Postman. In this article, you will find an easy tutorial on how to set up Postman and how to perform simple conversions using it. A link to the necessary collection file is also provided.

Alternatively, you can check out this video tutorial:

 

Now, on to the actual batch conversion. The following code represents a simple API post command using a remote file as an input. With this conversion, our input is a single JPG image which will be converted into the PNG format.

{
    "input": [{
        "type": "remote",
        "source": "https://cdn.online-convert.com/example-file/raster%20image/jpg/example.jpg"
    }],
    "conversion": [{
        "category": "image",
        "target": "png"
    }]
}

By changing this input, you can perform different batch conversions as will be shown below.

 

Different Files To One Output Format

In order to convert different images to PNG, all you have to do is add them to the input of the conversion. As you can see in the code, they don’t even need to be of the same format. You can convert several JPG images at the same time with JPEG or GIF images.

{
    "input": [{
        "type": "remote",
        "source": "https://cdn.online-convert.com/example-file/raster%20image/jpg/example.jpg"
    },
    {
        "type": "remote",
        "source": "https://cdn.online-convert.com/example-file/raster%20image/jpg/example_small.jpg"
    },
    {
        "type": "remote",
        "source": "https://cdn.online-convert.com/example-file/raster%20image/jpeg/example.jpeg"
    },
    {
        "type": "remote",
        "source": "https://cdn.online-convert.com/example-file/raster%20image/gif/example.gif"
    }
    ],
    "conversion": [{
        "category": "image",
        "target": "png"
    }]
}

And that’s really all you have to do to convert multiple files to one output format. Send your GET request and you will receive your converted files in a ZIP folder. Depending on how many files you are converting and how big the files are, the conversion will take a couple of seconds.

 

One File Into Different Output Formats

In some cases, you may want to do a batch conversion the other way round though. In this case, the changes to the simple call are not done with regard to the input, but the output of the conversion. In the example below, the same image is converted both to PNG and GIF.

{
    "input": [{
        "type": "remote",
        "source": "https://cdn.online-convert.com/example-file/raster%20image/jpg/example.jpg"
    }],
    "conversion": [{
        "category": "image",
        "target": "png"
    },
    {
        "category": "image",
        "target": "gif"
    }]
}

Send your GET request of this one and you will receive both converted files. Depending on how many files you are converting and how big the files are, the conversion will take a couple of seconds.

 

All In One

Of course these conversions also work combined and across file types. In the following example, we convert various inputs to different output files of different types:

{
    "input": [{
        "type": "remote",
        "source": "https://cdn.online-convert.com/example-file/raster%20image/jpg/example.jpg"
    },
    {
        "type": "remote",
        "source": "https://cdn.online-convert.com/example-file/document/rtf/example.rtf"
    }],
    "conversion": [{
        "category": "image",
        "target": "png"
    },
    {
        "category": "document",
        "target": "pdf"
    }]
}

 

Got any questions?

If you have any questions regarding our API or batch conversions using our API, feel free to get in touch with us. Our friendly support team will take care of you. 🙂

Also, check out our video tutorial on how to do batch conversion with the Online-Convert.com API.