REST API component

REST API Usage Example

REST API Usage Example.

Introduction

The REST API component can be used for all sorts of purposes - from receiving NYT news articles for a given month, going back to 1851 to communicating between online stores and search engines. We want to show you an example of the use of REST API component in which we will use data on green energy to understand when there is a lot of renewable electricity on the grid that can be used in a household. If the Green Index is high enough, a lot of electricity is available from renewable sources. During this time, you can use household appliances climate-friendly.

Flow example

In this example, we want to create a table that shows the efficiency of using green energy over a certain period of time. To accomplish the task, we created this flow:

Flow example

Use the REST API component to get the necessary information on green energy. To do this, select the GET function and define a URL. In our case, we use Currently GrünstromIndex website as a source of information:

Rest api input

Here is URL from our example: https://api.corrently.io/v2.0/gsi/prediction?zip=53177

As a Sample you will receive the necessary data:

Rest api Sample

After that please process the data using a Splitter component. We use “Split on JSONata Expression” action:

Splitter

The last component that we use in the integration flow is the Google Spreadsheet component. Here select a pre-created spreadsheet with first row as header values and match the information you need with these headers:

Configure Spreadsheet

After you publish the draft and run the integration flow, your spreadsheet will be updated with the data received from your flow:

Forecast Spreadsheet

Click here to learn more about the elastic.io iPaaS