How to automate file conversion in java using Api’s6 min read

In order to automate file conversion we need some api’s in order to code your way out with some minimal code currently we are using zamzar api to convert around 1200 different types of files using the java code and Apache HTTP server.

There will be a free developer account you need to run on the cloud by exporting the files to their cloud and the code will automatically download it from their server.

First up you need to obtain Api key in order to get started with the conversion

You can also find this code on their website.

The JSON response provides some information about the GIF file format, such as the target file formats which Zamzar can convert GIFs to.

They have provided with an example JSON response

To Start the conversion you need to send the request to their server for them to create an endpoint it is better to keep the file size below 1MegaByte not because they are saying that but just to test it out at first whether it is working or not after the endpoint you have to send a key value pair of hash on which format is converted into which format.

There will be status showing you whether it is initialising or it will throw an exception.

Here is an Example JSON Response

Zamzar api is now converting your file. Before you can access the result, you should check to see whether your job has finished successfully, by sending a GET request to the jobs/ID endpoint. In this request, you’ll need to use the unique identifier returned by Zamzar when you created your job.

Once the file conversion is success ful you will receive a JSON stating the file conversion is successful.

Now finally download the file from the zamzar cloud and delete the file in their server.

This is the basic conversion of the file but you can know more in their developer page they also provide support to PHP,Python,C#,ruby etc.

You can know mmore from here : link

Take your time to comment on this article.

Leave a Comment