SimpleRESTHost

Assemble and publish a REST web service endpoint by implementing its web methods through events using SimpleRESTHost.

Properties

Base URI

The Base Url of the web service must be configured to be hosted on the server that it is deployed to.

To achieve this in Linx, use the + wildcard character instead of your hostname in the Base Url property.

https://+:{port}/{path}

Base URI

When the service is deployed it will use the current server.

Security

The security scheme to use.

API Key and HTTP Bearer are supported.

When hosting a web service you need to indicate what the security requirements are for granting clients access to your web service.

When selecting the API Key security scheme it means that:

a) a client that consumes your web service must provide a key value that is associated with your API, and

b) your application must authenticate the key value that is received from the client.

Your web service application will receive the API key via a request header, named 'Authorization', that Linx makes available at =$.Input.Data.AuthenticationData.ApiKey.ProvidedToken.

Authentication of the received key is performed in the SimpleRESTHost service's OperationEvents_Authenticate event handler.

Do the following:

  1. Set a String variable to $.Input.Data.AuthenticationData.ApiKey.ProvidedToken.

  2. If the required key is stored in a database, check if the provided key matches the key in the database.

  3. If there is a match, set $.Output.Data.HttpContext.User.IsAuthenticated to 'true'.

Bearer secret

Only available when 'HTTP Bearer' is selected for the Security property.

The HTTP bearer secret key, for issuing and authenticating security tokens.

Operations

Define your web API operations. Click on the Operations Editor icon [...] to add your operations.

Operations

Show server errors

Hide or show details for internal server errors in HTTP responses. Note that this is a security consideration for production systems.

Values: true / false

Max connections

The maximum number of concurrent connections to accept (per client). Use -1 for infinite, or null to use the machine wide setting from the registry. The default value is null. For more details on how to find out what the registery default is, go here: https://docs.microsoft.com/en-us/troubleshoot/iis/httpsys-registry-windows

Max request size

The maximum allowed size of any request body, in megabytes.

Default: 30

API documentation

Select either 'Redocly' or 'Swagger UI' to generate documentation for your API.

To access your generated documentation, append /swagger or /redocly to your Base URI, depending on the documentation type.

For more on API documentation go here.

CORS origins

A list of allowed origin URLs for cross-origin resource sharing.


OpenAPI Specification

Wikipedia: Representation state transfer (REST)

Swagger

Cloud server API deployment