UpGuard can be used to generate endless possibilities of log outputs for integration with any generic REST Endpoint. In this tutorial, we will learn to integrate calling a REST Endpoint with UpGuard.

Prerequisites

To add a REST Endpoint Integration you will need to collect:

  • The URL of the endpoint you want to connect to.
  • Whether the endpoint requires authentication.
  • The method by which you want to call the endpoint (either GET or POST)
  • If there is body you would like to include with the endpoint request when the integration is tested for connectivity.

For the example below, we’re going to call a REST endpoint with Slack to post a message. We’re using Slack as it is a common and easy to follow example - however, if you want to integration with Slack, we recommend using the Slack Integration instead.

Adding a REST Endpoint Integration

  1. To add a REST Endpoint integration, navigate to Control > Integrations.

    w800

  2. Click the Add Integration button from the Integrations page w800

  3. Choose REST Endpoint. w800

  4. Fill in the relevant fields..

    w400

For Basic Auth, the UpGuard equivalent of curl --user username:password https://... is

w400

For Authorization Header, the UpGuard equivalent of curl -H 'Authorization: Token token="1234"' https://... is

w400

Click Done to finish creating the integration. As part of the creation process, the REST endpoint will be called to confirm the details are correct. In the case of the Slack web hook we’ve used here, you should receive a message in Slack. See below for more details.

Check that REST Endpoint Integration is set up correctly

  1. Navigate to Control > Integrations. w800

  2. The REST endpoint should be available in the list of integrations. w800

  3. You will also have the message posted to the REST Endpoint. In this case, there will be a slack message.

    w400

What Next?

Now that you have a REST Endpoint integration set up, you can use it as the basis for an action trigger when a particular type of event occurs. For more inforation on setting up event actions for a REST Endpoint, please view our guide on REST Endpoint Actions.