CADViewer Technical Documentation, Installation Guide and Reference Samples Library

CADViewer RESTFUL API

The TailorMade CADViewer RESTFUL API is implemented by our server side infrastructure components, which allows users to send AutoCAD DWG, DXF and DWF files, MicroStation DGN, Adobe PDF, and other high resolution floorplans in vector formats into a server for processing.

The CADViewer restful server responds with a number of various formats, JSON and CSV for data extraction, SVG and PDF for data conversion.

Additionally, a http link-instance of the CADViewer standard interface including the CAD file passed over, can be returned for encapsulation into an application.

In this document we freely interchange, CADViewer RESTFUL API, TMS REST API, CADViewer REST API, etc.

Implementation

The CADViewer RESTful API (TMS REST Api) provides a web-service access to the Tailor Made Software conversion and extraction tools. The interface is build based on a JSON encapsulation in the call structure using HTTP POST. A slimmed down version of the converter infrastructure can be downloaded and implemented on a server so the conversions and viewing on-the-fly of AutoCAD files can be directly controlled. Below is a description of the interface and guidelines on how to implement.

The call to the TMS REST API is done with an HTTP post cals. Either a JSON formatted String is posted directly to the API, alternatively the content of the POST variable ‘request’ can contain the JSON encoded request.

The TMS REST API is password protected. It can run in several modes with various level of access to the conversion and data extraction engines. A trial mode is available where graphics output has a watermark added and xml output is somewhat obfuscated.

Files can be either retrieved or sent via streams, base64 encoded as part of the REST call or via Url to file location.

CADViewer

In the CADViewer front-end library, there is implemented a direct access from the library to the CADViewer RESTful API.The parameter controls, choice of conversion engine etc. is set through the CADViewer API. If the CADViewer is not licensed or in trial mode, the conversion through the REST Api will run in trial mode.

The functional interface below is embedded into the CADViewer class lib and therefore hidden from the user.

NOTE: All CADViewer Handler Scripts implements the CADViewer REST API!

NOTE 2: If the application programmer wants to write their own middleware connecting CADViewer with a server service, then a custom implementation of the CADViewer RESTFUL API can be useful.



Request - Response strucure

The CADViewer REST API operates with users placing a call to the Conversion Server end-point JSON request object, where the server then subsequently responds with a JSON object.

The JSON response object will contain information on how to access any results from the request query.

Below are the structure of the Request/Response call listed as JSON code with value pair description:


URL End-point to REST API

The actual request-response call with need a URL end-point to connect to the REST API server. The REST API End-points supported by CADViewer server scripts on the various platforms are:

Platform End-Point
NodeJS /callapiconversion
PHP /call-Api_Conversion.php
Tomcat Servlets /callApiConversionServlet
dotNet /callApiConversionHandler.ashx
dotNetCore /callApiConversion

Sample Call Methods to the REST API

Depending on Server implementation the Ajax call (or whatever technology preferred) can be either:

  • Post call call to the End-Point Url.
  • Jsonp Post call to the End-Point Url.


Implementation Samples - Data Extraction, CAD Conversion and CADViewer Display Tests

Download

Download the sample code for this CADViewer REST API Sample from our GitHub repository: CADViewer REST API Conversion Server sample.


Last updated on 22 Mar 2022
Published on 22 Mar 2020