Configure a server script API

In this topic, you learn how to configure an API to communicate with a server script.

Prerequisites

  • You have created a server script, for example, with the Script Editor.

Procedure

  1. In the Cockpit, go to Connectivity and select API Designer.

  2. In the API Designer, select Add.

    Result: The API configuration window opens. You start in the General tab.

  3. In Type, select Server Script.

  4. In API format, Swagger 2.0 is preselected. You can select the newer version, Open API 3.0, here.

  5. Enter a Name for your server script.

  6. If you created a package or group for your APIs, applications, oData, and mock data before, you can select those from the Group or Package drop-down menu.

  7. Enter a short and meaningful Description to your API.

  8. In Version, enter a version number, for example, 1.0, to keep track of changes to the API.

  9. In Media Type, define the type of content of your API. This is needed to communicate with your browser. By default, it is application/json.

  10. Activate any of the following options that fit your application:

    Allow Untrusted Certificates

    Allowing SSL/TLS certificates from servers that may not be considered "trusted".

    Enable Anonymous Access

    Allows public access to the API. It will replace the existing endpoint to /public/serverscript/.

    Enable Trace

    Allow tracing activities of your API. You can see activities in the API Trace.

    Run server script in own process (slow performance)

    When enabled, the API triggers the selected script, initiating a dedicated process that terminates once the script has completed its execution.

    Use in App Designer & App Editor

    Allow this API to be used in the App Designer or App Editor.

  11. Select Save.

Results

  • Your API is saved with the current settings and is added to the library in the API Designer.

  • The API Designer adds an ID to your API and saves change dates.

Next steps