Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this article

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

Overview

This use case demonstrates how you can use SnapLogic Data Science to configure SnapLogic Pipelines as REST APIs to receive requests from external applications. Currently, we support the following two types of REST APIs that are called tasks in SnapLogic:

...


Triggered TaskUltra Task
ObjectiveTrigger the API using a URLReal-time API that has a very low response time
LatencyHighVery low
Resource ConsumptionStart a new Pipeline execution for each requestThe Pipeline is active all the time
Number of DocumentsAny number of input/output documents1 input document for 1 output document

This document explains how you can use the SnapLogic platform to run the Pipelines as APIs and is structured as follows:

  • Data Science API Pipeline: Describes the Pipeline you must build to run as an API.
  • Request format: Describes the request format to send API requests.
  • Configuring and managing Ultra Tasks: Describes how to schedule and manage Ultra Tasks.
  • Testing Ultra Tasks: Describes how to test the Ultra Tasks.

...

To configure an ultra Task:

  1. In the Designer page, click the triangle on the right to expand the Designer toolbar. Then, click the Calendar icon to open the Create Task dialog.
    Image Removedthe Designer toolbar, click Create Task.

    Image Added

  2. Select Ultra in Run policy and remove the Bearer Token to remove authentication.

    We recommend that you use a Snap to perform authentication inside the Pipeline. To authenticate within the pipeline, send the static token snaplogic_ml_showcase using the JSON Generator Snap through the REST Post Snap to send a request to the Ultra Task.
  3. Use a Filter Snap in Data Science API Pipeline to compare your authentication details against a static token, as shown in the below screenshot. This step verifies the static token passed from the ultra task.
    Image Modified
  4. Optional. Specify Instances. This is the number of API instances to be run in parallel across nodes in the Snaplex.

    We recommend that you use at least two API instances to provide fault tolerance. You can find more information about Ultra Tasks here.

...

  1. Click Create in the Create Task dialog and click Show tasks in this project in Manager to go to the Manager page.
  2. Click the task name to edit the task settings.



  3. Click  next to the task, and then click Details. The task detail popup appears, complete with the HTTP Endpoint URL.



  4. Click Details to see the task statistics. You can see that there are 7 API instances that have started so far.

    Image Modified

However, only 2 API instances are running as shown in the following image from the Dashboard page. The API instance stops, and a new one is created if the Pipeline fails.

Testing Ultra Tasks

There are many tools that you can use to test your Ultra Tasks (APIs). However, if you would like to have a regression/automated test, we recommend that you build a Pipeline to do this, so you can schedule it to run on a daily/weekly basis.

Pipeline

Use the JSON Generator Snap to generate a sample request and use the REST Post Snap to send a request to the Ultra Task. You can download this Pipeline here.

...