Skip to end of banner
Go to start of banner

Running a Triggered Task

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

The SnapLogic Platform offers various ways to run Tasks. Because Triggered Tasks are a convenient way to give API consumers a URL to invoke a Pipeline without actually granting them access to the SnapLogic Platform, you should consider how and where the Task is executed.

Regardless of the type of Snaplex set for the Task and underlying Pipeline, you can call a Triggered Task through the Cloud URL or Snaplex URL, which is the Self-managed Snaplex (Groundplex). The behavior of running the Triggered Task from the Cloud URL differs from that of the Snaplex URL. When you invoke the Triggered Task through the Cloud URL (for example, using a CURL command), the call is routed to the Control Plan, both of which are in the Cloud. If the request is successful, an HTTP 200 response is sent to the client upon completion of the Pipeline run. However, when you call a Triggered Task from the Snaplex URL, the HTTP 200 response is sent immediately, even though the Pipeline is still running. This behavior is the result of the additional network routing that occurs because the request is sent to the Control Plane from the Self-managed Snaplex.

You can invoke a Triggered Task using one of the following methods.

From SnapLogic Manager:

  1. In Manager, navigate to the target Task, and click  to display the dropdown list, then click Details


  2. Click Execute for the URL to run the Pipeline (you may be prompted to log in).

    Alternatively, you can click  to copy the URL, and then paste it into a browser.

    Executing the Task by clicking Execute in Manager automatically picks up the authentication credentials.

    Duplicate Task Executions

    If a Task fails to start with the same reason for multiple times in a row, then subsequent skips are not displayed on the Task details page.

From a Client Machine:

  • In your browser window, copy and paste the URL generated for the target Task.

    Authentication

    The external URL created for a task requires you to be authenticated with the SnapLogic servers. When using a web browser to access the URL, you might not have to provide credentials since you might already be logged into the Designer. Using other methods to request the Task URL requires you to provide credentials using HTTP Basic Authentication.

  • Alternatively, you can run Tasks from a CLI using Curl commands. 


For information on API Management aspect of Triggered Tasks, see API Management.

If your account is locked or your password expired, you can still execute Triggered Tasks; however, you cannot invoke SnapLogic Public APIs, and your Scheduled Tasks will fail to execute.

CURL Command Examples of Triggered Tasks

This section covers some examples of using the CURL command-line tool to access Task URLs.  The following are only examples of the syntax and are not functioning URLs.

Run a Pipeline that takes no input and has an unlinked output view that writes documents:

$ curl -u 'user@example.com:mypassword' 'https://elastic.snaplogic.com/api/1/rest/slsched/feed/example/jobs/test-reader'
{ "msg" : "Hello, World!" }

Run a Pipeline that takes a parameter and has an unlinked output view that writes a document:

$ curl -u 'user@example.com:mypassword' 'https://elastic.snaplogic.com/api/1/rest/slsched/feed/example/jobs/test-hello?Name=John'
{ "msg" : "Hello, John!" }

Run a Pipeline using a Bearer token for authentication through a header:

$ curl -H 'Authorization: Bearer Xrcuwn2zVLqR7KXXXXXXXXX' 'https://elastic.snaplogic.com/api/1/rest/slsched/feed/example/jobs/test-hello?Name=John'
{ "msg" : "Hello, John!" }


Run a Pipeline using a Bearer token for authentication through the bearer_token query parameter:

$ curl 'https://elastic.snaplogic.com/api/1/rest/slsched/feed/example/jobs/test-hello?Name=John&bearer_token=Xrcuwn2zVLqR7KXXXXXXXXX'
{ "msg" : "Hello, John!" }


Run a Pipeline that accepts a JSON document and transforms it:

$ curl -u 'user@example.com:mypassword' --data-binary '{ "name" : "Bob" }' --header "Content-Type:application/json" https://elastic.snaplogic.com/api/1/rest/slsched/feed/example/jobs/test-transformer
{ "msg" : "Hello, Bob!" }
  • No labels