# API Documentation generation

**URL:** https://community.linx.software/community/t/api-documentation-generation/472
**Category:** Feature
**Created:** [November 3, 2020, 8:41am UTC](https://community.linx.software/community/t/api-documentation-generation/472 "2020-11-03T08:41:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ronan](https://community.linx.software/community/user_avatar/community.linx.software/ronan/32/433_2.png) [@ronan](https://community.linx.software/community/u/ronan)
#### Post date: [November 3, 2020, 8:41am UTC](https://community.linx.software/community/t/api-documentation-generation/472/1 "2020-11-03T08:41:56Z")

</div>

# API Documentation

A new `API documentation` feature has been added to the SimpleRESTHost and RESTHost .

This functionality 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](https://swagger.io/tools/swagger-ui/)
- **Redocly** : Documentation will be generated with [Redocly](https://redoc.ly/)

Once the service is deployed and activated, navigate to:

```http
#base_uri#/swagger

```

Or

```http
#base_uri#/redocly

```

So for example, if my Base URI is configured to:

```http
https://+:8022/service

```

And I’m hosting it on the cloud server:

```http
https://test.linx.twenty57.net

```

To access the API Documentation, I would navigate to:

```http
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
http://localhost:8080/service

```

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

```http
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
http://localhost:8080/service/documentation/openapi.json

```

Alternatively, click on the below relevant options:

**Redocly:**

 ![image](https://community.linx.software/uploads/default/original/1X/0ca0364c0f5b915e5564bd3656ad37a058a2d4f9.png)

**Swagger UI**

 ![image](https://community.linx.software/uploads/default/original/1X/62858060415596b73f778293affeedf465cffb54.png)

This will then generate the Open API Definition like below:

```json
{
  "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 .

## Next steps:

> 🎯 [**Get started**](https://community.linx.software/t/resthost-get-started/466) with a “Hello World!” API.
