API Gateway

Prev Next

Securely expose third-party existing APIs through the DPS API, ensuring compatibility, protection, and access control.

Once the plugin has been enabled, you can configure the Endpoints to include in the DPS API.
Once complete, you can use a standard DPS API to invoke your own endpoints, masking the actual URL and security information (e.g., API key, tokens).

For instance, giving this Endpoint:

Name: production-forecast
Method: GET
URL: https://internal.acme.com/api/production/forecast
Parameters: machineId=${request.serialNumber}
Headers: api-key=abc123

You can invoke a generic DPS API that, on the cloud side, makes the real request to the external service.

GET https://acme.servitly.com/api/gateway/production-forecast?serialNumber=M0123

The DPS backend extracts the request parameters and payload (if present), and, according to the configured endpoint, executes the request to the remote endpoint.

GET https://internal.acme.com/api/production/forecast?machineId=M0123
api-key=abc123

Within URL, parameters, header, and payload, you can use placeholders to make them dynamic.
For instance, the placeholder ${request.serialNumber} is resolved by extracting the serialNumber parameter from the request made to the DPS API.

To propagate the payload (in case of PUT, POST, PATCH), you can use the placeholder ${request.payload}.
The remote endpoint response is synchronously forwarded to the DPS API client who made the initial request.

Optionally, you can define the list of User Types that are authorized to invoke each endpoint.

Refer to the API Documentation for more details about how to invoke endpoints.

If needed, you can test the invocation of your endpoints using the Webhook online service.

Error Codes

The DPS /api/gateway endpoint may return these codes.

  • 400 (Bad Request): If the payload is missing in case of POST, PUT, or PATCH.

  • 401 (Unauthorized): If the User Type associated with the user who made the request is not authorized.

  • 403 (Unauthorized): If the DPS is not logged in, or its User Type is not authorized.

  • 404 (Not Found): If the endpoint name passed does not exist.

  • 405 (Method Not Allowed): If the endpoint is found by name, but the method does not match.

  • 408 (Request Timeout): If the request to the external service takes more than 60 seconds.

  • RESPONSE CODE: If the request is made to the remote service, any response code is returned to the client that made the initial request.

Plugin Configuration

To enable this plugin, you need to:

  1. Go to the Integrations / Plugins page.

  2. Select the Data Integration category.

  3. Locate the API Gateway card.

  4. Click on the card switch to activate the plugin.

  5. Configure the plugin properties and save.

Here is the list of all the properties that can be used in the plugin configuration.

PROPERTY

DESCRIPTION

Endpoints

The list of remote endpoints you want to integrate into the DPS API.

Type: ARRAY of ENDPOINTs | Mandatory

Here are the properties describing a remote Endpoint .

PROPERTY

DESCRIPTION

Name

The string that uniquely identifies the endpoint.
This name is used as part of the path in the DPS API endpoint.

You can define at most one endpoint with the same name and method.

Type: STRING | Mandatory

Method

The HTTP method to be used to invoke the endpoint.

You can define at most one endpoint with the same name and method.

Type: ENUM | Mandatory

Values: GET, PUT, POST, PATCH, DELETE

URL

The endpoint URL to invoke.

Type: STRING | Mandatory

Parameters

The list of parameters (name and value) to be added to the URL as a query string.

Type: ARRAY | Optional

Headers

The list of headers (name and value) to be added to the request.

Type: ARRAY | Optional

Payload

The text payload to send in case of PUT, POST, or PATCH.

To propagate the request payload to the remote service, you can use the placeholder ${request.payload} in the payload text area of the endpoint.

Type: STRING | Optional

User Types

The list of User Types that are authorized to invoke this endpoint via the DPS API.

IF empty, all User Types are authorized.

Type: ARRAY | Optional