Word Cleaner Web Rest API

How to call our API to convert documents to HTML from within your own application

Before you begin you need to have an account with our Word Cleaner Online Web App. If you have not done so please register for an account now. You can test the service for free but for production you will need to sign up for one of our paid plans.

Currently the Word Cleaner Web Rest API exposes the following API method:

https://api.wordcleaner.com:8080/api/converter/convertdoc - this API method will convert files sent via POST and will return or post back to a given URL the converted zip or html file.

The input parameters are:

  1. send single or many files in FormData (JavaScript) or MultipartFormDataContent (.NET C#), see the sample page or the C# code app for implementation details
  2. template - optionally specify a template name parameter, for instance: 'Convert to HTML5' . This template is used by default if a parameter is not specified. The template name has to be exactly as on Word Cleaner Online templates list, note you can create your own custom templates.
  3. returnJson - option to return json with list of converted output file URLs (attention: do not set returnHtml or returnData options if you use returnJson)
  4. returnHtml - option to return either a zip file (set it to false) with all the conversion files in it or a single html file (set it to true). By default it's set to 'false' - return a zip file. To return only a HTML file set this option to 'true'. Please note that if you set it to true then only the html file is returned, other files like images or CSS files are not sent. Only the zip file option contains all the converted files.
  5. returnData - option to return raw octet-stream data, default is 'false' and it returns url to converted file on the Word Cleaner Web API server
  6. backUrl - if specified WC API method will convert input files and will send them in zip or html file back via POST to that specified url.
Please note that you need a website or server to process these post request, please check out ReceivePostFile.zip sample ASP.NET app that receives file sent via POST from that API method.


Check out our web example page...

We have created a sample page that demonstrates how the API conversion works: PostConvertReturn.html

How to use the sample page:

  1. enter your login credentials, the same login as your Word Cleaner Online account and click the Log In button. If you don't have a Word Cleaner Online account yet please Register for free.
  2. select the input document files that you want to convert
  3. optionally enter a template name
  4. optionally choose if you want to return a zip file with all output conversion files or just get the html file back
  5. optionally choose if you want to return raw data or URL string to that data file located on WC server, using this raw data option with return html option is useful if you want to use only converted html right away after the server response
  6. also you can enable sending file back to given URL via POST, please specify your own working Post back URL

Please view the HTML and PostJsCode.js file source code of that page to see how you can use this API method.

Example .NET Winforms C# app...

Please check out WebAPITestApp.zip sample .NET Winforms C# app that does the same as PostConvertReturn.html sample page. Based on that sample app C# code you can write code for ASP .NET MVC web applications as well.

Example PHP code ...

Please check out WebAPIPhpSample.zip sample PHP/HTML code that demos how to get API token and convert uploaded file. Extract zip to a php web server. Edit convert.php file and enter your Word Cleaner Online email and password on line 28. Set write permissions on upload/ folder if needed. Go to index.php in a browser, then select document to convert and click Start Converting button.

Example Java code ...

Please check out WebAPIJavaSample.zip sample Java code that demos how to get API token and convert uploaded file. Extract zip and edit WordCleanerWebApi.java file and enter your Word Cleaner Online email and password in GetAccessToken() method. Enter your doc file name and path and run.

The Web API uses the same template files that you got on your Word Cleaner Online account; therefore, you can use the Word Cleaner Online version to prepare your template and preform any testing.

Questions? Contact us anytime.