Skip to content

tutorial scheduled rest call

Bruno Gonçalves edited this page May 17, 2022 · 15 revisions

In this tutorial you learn how to create a request/reply flow calling a REST API through a scheduler. We start with the flow created in the Quick Start.

Step 1: Clone flow

  • Like in tutorial1 clone the 'TestFlow'.

CloneFlow

Step 2: Configure the flow

  • Give the flow the name 'REST'.
  • Change the URI scheme of the From endpoint to Scheduler and the Path context to "foo"
  • Set the URI option "Delay" to "60000"

This means the connector will run every 60 seconds. Triggering the To endpoint.

SetSchedulerEndpoint

  • Set the URI scheme of the To endpoint to REST and the Path context to "get:api/v1/employees"

    Tip: Use the Enter key after filling a context value. Alternative use the context editor (blue pencil button) to change context values.
    
  • Set the URI option "Host" to "http://dummy.restapiexample.com"

SetRestEndpoint

As a last step we add a Response endpoint:

  • Click in the To endpoint "Add Reponse Endpoint"
  • Set the URI scheme of the Response endpoint to FILE and the URI context to "C:\test1"

SetFileEndpoint

After the changes you can save the flow.

Step 3: Test the flow

  • Start the flow 'REST'

  • Check the folder "C:\test1" (after 60 seconds a file with content should appear on disk)

    Tip: Check the log file to see what's happing on the background. Administration --> Log viewer. 
    

More on logs files.

Explanation on REST

The REST Component can be used to host a REST endpoint (as a server) or call a REST Endpoint (as a client). More info you can find on the REST Component page.


next tutorial to create simple route.

Clone this wiki locally