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.
- Specification of the Request-Response call.
Below are the structure of the Request/Response call listed as JSON code with value pair description:
- JSON code to Request Available Engines
- JSON code to Request Conversion/Extraction/CADViewer Display
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.
- JavaScript code for the two Sample Call Methods to the REST API
Implementation Samples - Data Extraction, CAD Conversion and CADViewer Display Tests
-
JavaScript code for Template objects for data extraction/conversion/cadviewer display
-
JavaScript code for Sample settings of CADViewer API Endpoints
-
JavaScript code for Pulling it all together
Download
Download the sample code for this CADViewer REST API Sample from our GitHub repository: CADViewer REST API Conversion Server sample.