This document makes use of our REST API v2 calls.

On the elastic.io platform it is possible to schedule the tasks the way it is suitable for you. Previously, our old designer had some rudimentary menu built into the integration flow creation process. The new interface equivalent is currently in making. This document is going to show you how to configure your integration flow using our REST API v2 calls.

Here is what you need

Changing the scheduling of the flow means changing and modifying the flow. Here are the requirements for this to work:

  • You need to be the owner of the flow or be a member of the same organisation to be able to modify the flow.
  • You need to read the instructions on how to work with our REST API calls.
  • You need to use your own API Key along with your e-mail address which can be found on your profile page. If you are a member of the organisational unit then you need to use your Organisational API Key.
  • You need to make sure to familiarise yourself with the time-based job scheduler in Unix-like computer operating systems called cron. You can create and experiment with it in crontab.guru page.
  • You need to restart your flow after the scheduling is changed or applied in order for our system to take the new changes.

Here is how to schedule your flows

Please familiarise yourself with the API calls for updating the flows. In particular, we are looking for a construction like this:

curl https://api.elastic.io/v2/flows/{FLOW_ID} \
   -X PATCH \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
    {
          "data": {
            "type": "flow",
            "id": "{FLOW_ID}",
            "attributes": {
              "name": "this is a test task"
            }
          }
     }'

In this example you would need to get the information for:

  • Your {FLOW_ID}. This is easily accessible when you open your flow for editing in the designer. The last part in the browser address bar here is the ID that you want. When you paste that ID please do it without the curly brackets. So your first line could be like this curl https://api.elastic.io/v2/flows/123123123a88ba6a700191y8y8yjkl.
  • From your profile page get your {EMAIL} and {APIKEY}. Together you should have a construction like your@email.com:ApiKey, again without curly brackets.
  • Further down in the configuration part put the same flow ID instead of {FLOW_ID}. Don't forget to omit curly brackets and use the quotes "id": "123123123a88ba6a700191y8y8yjkl".
  • In the attributes part you would need to choose the attributes.cron and supply a correct value. Something like this "cron" : "*/30 * * * *" which would mean to run every 30 minutes. For more examples and possibilities please check the crontab.guru page.

Collecting this all together for our example we would need to make an API call like this:

curl https://api.elastic.io/v2/flows/123123123a88ba6a700191y8y8yjkl \
   -X PATCH \
   -u your@email.com:ApiKey \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
    {
          "data": {
            "type": "flow",
            "id": "123123123a88ba6a700191y8y8yjkl",
            "attributes": {
              "cron": "*/30 * * * *"
            }
          }
    }'

Please note you need to restart your flow before your applied scheduling can be used by the system.