How to Autodetect Content Type & Validate using Go

Validation steps play an important role within any application, ensuring incorrectly formatted data doesn’t move downstream and cause potentially significant problems/delays in production. By taking advantage of our Autodetect Content & Validate API, you’ll reap the benefits of a built-in service capable of instantly determining the type and validity of various documents’ contents. In its response, this API will identify the input file format’s extension and supply a Boolean value indicating if the document is valid or not. If any issues were found within the document, the response will indicate exactly how many errors and warnings were detected and provide a description (if available) for both.

With the complementary, ready-to-run Golang code examples provided below in this article, you can quickly and easily build this API into your application. All you need is a valid Cloudmersive API key to authenticate the service (you can get one by registering a free account on our website) and you’re ready to make your API call.

To structure your API call, include the below code in your environment, and supply your API key & file path in their respective fields:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.