Is there a way to retrieve the supported conversions for a given format?

Hello, everybody.

As the title suggests, I’m interested in getting my hands on the possible conversions of a specific file.

I’m looking for an endpoint or something similar that will provide me with a map with all the possible conversions:

Or maybe only one row of the previous map. For example, providing the csv extension, I will get the list [bmp, gif, jpg, ods, ots, pdf, pdfa, png, xlsm, xlsx, xltm, xltx] representing the available conversions for the given extension.

Hello @trrenty
Please provide us with details. What is your final goal? You provided correct link to Conversion API, but I’m not sure that I understood your request.

When editing a specific file with OnlyOffice Editor I would like to provide additional UI to enable the user to convert that file in some other supported format. For example, I have a .txt file that I want to open in my application and the user should have a drop down list of extensions in which the text file can be converted to, ie: doc, docx, odt. To populate that list, I would need to either hardcode some maps such as the tables in the Conversion API Docs -

where the Input format column corresponds to the values of the filetype parameter and the Output format columns correspond to the values of the outputtype parameter

OR to retrieve this information from somewhere in your API. I was thinking if maybe this service https://documentserver/ConvertService.ashx accepts, for example, a GET method https://documentserver/ConvertService.ashx/{extensionName} that would give the possible/accepted output formats for the given extensionName.

Editor already has ‘download as’ and ‘save copy as…’ features. So, in general user can save file with necessary format via editor interface.

OR to retrieve this information from somewhere in your API. I was thinking if maybe this service https://documentserver/ConvertService.ashx accepts, for example, a GET method https://documentserver/ConvertService.ashx/ {extensionName} that would give the possible/accepted output formats for the given extensionName .

No, Conversion API uses POST.

About your scenario in general. You mentioned drop down list of extensions where user can choose necessary format for file conversion. I believe that you can achieve this scenario. Probably it should look like this:

  1. Additional tab with ‘drop down list of extensions’ outside of editor frame.
  2. when a user chooses format for saving, your app sends API request to Document server (https://documentserver/ConvertService.ashx) to convert a file, which is located on your app side.
  3. Document server returns link to a new file and you can download it and place to necessary path.

In such scenario you don’t need to run editor interface. But you need to send API requests to Document server.

If I misunderstood your request, please clarify it.

Thank you for your time and answers.

1 Like