RESTHost - Documentation generation

The SimpleRESTHost and RESTHost services include functionality that involves automatically generating the API documentation of the service.

In order to generate the documentation when the service is active, select the type of API documentation from the service Properties in the Linx Designer:

  • None: No documentation will be generated
  • Swagger: Documentation will be generated with Swagger UI
  • Redocly: Documentation will be generated with Redocly

Once the service is deployed and activated, navigate to:

#base_uri#/swagger

Or

#base_uri#/redocly

For example, if my Base URI is configured to https://+:8022/service, and I’m hosting it on the cloud server https://test.linx.twenty57.net, to access the API Documentation, I would navigate to:

https://test.linx.twenty57.net:8022/service/swagger

This then allows external users to view the possibilites of the web service.

If you are still developing your web service, you are also able to generate the API documentation locally using service debugging by setting your Base URI to http://localhost:8080/service.

To access the API Documentation locally, the service is debugged then the below URL is navigated to:

http://localhost:8080/service/swagger

Generating an API Definition

You are also able to access the actual API definition of the web service which can then be used to:

  • Convert a SimpleRESTHost into a RESTHost by importing the the Open API Definition as the API Definition property.
  • Import the definition into another Solution
  • Use the definition externally

To download the API definition, navigate to the below URL:

http://localhost:8080/service/documentation/openapi.json

Alternatively, click on the below relevant options:

Redocly:

Redocly

Swagger UI

Swagger

This will then generate the Open API Definition like below:

{ "openapi": "3.0.1", "info": { "title": "Web API", "version": "1" }, "servers": [ { "url": "http://localhost:8080/service" } ], "paths": { "/customers": { "get": { "operationId": "GetCustomers", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "string" } } } } } } } }, "components": {} }

You can then copy this JSON structure out and import it as the API Definition of the RESTHost service.


RESTHost Overview Guide

Get Started - Hello World

Before and After operation events

Working with inputs

Securing your API

Deploying and common issues

Sample solution: CRUD and file operations

Sample

View our sample solution on GitHub.