Introduction
In this article, we will see how to automate data retrieval from an external API using Power Automate. Taking Exchange Rate API as an example, I will demonstrate how we can set up our SharePoint list to be updated consistently with all the latest exchange rates.
Why We Need This Automation?
- Accurate Data: Make sure SharePoint is always up to date with real-time data.
- Saves Time: No manual data entry anymore.
- Scheduled Update: Automation of data updates at predetermined intervals.
- Boosts Productivity: Reduces repetitive tasks for the team.
- Custom Data: Only allows the storage of the data points that are needed.
Setup External API
- We will use ExchangeRate-API to get the latest exchange rates.
- Create a User Account to Access the API Key:
- API Endpoint
Create a SharePoint list with desired columns
I am adding the below columns as an example.
- Base Currency
- Rupees
- Euro
- Kuwaiti Dinar
- British Pound
- Swiss Franc
Ensure that the relevant data types are selected for each column to ensure data integrity.
Create Scheduled Flow in Power Automate
Go to https://make.powerautomate.com and log in with your credentials.
Create a scheduled flow
- Click on "Create" and select "Scheduled Cloud flow".
- Select your desired recurrence.
- Now, in the flow designer, click on "New step" and search for the "HTTP" action.
- Configure the HTTP action.
- Run the flow manually to check whether data is coming or not. If the flow runs successfully, then in the Body section of the HTTP trigger, you will see the data.
- Copy the whole “Body” section in a notepad.
- Click on "New step" and search for the “Parse JSON” action.
- Use the “Body” of the HTTP response as the content in the “Parse JSON”.
- In the “Schema” section, Click on “Use sample payload to generate schema” In that, paste the “Body” of the HTTP response. It will generate a schema for the JSON.
- Now Click on "New step" and search for the "Create item" action from SharePoint.
- Select your SharePoint site and list and select column names we created in the SharePoint list from the dropdown “Advanced Parameters”.
- Using dynamic content, map the parsed JSON response fields to the columns in your SharePoint list. Below is an example-
- Rupees: Use the exchange rate for INR.
- Now, “Save” the flow and test the flow manually to confirm it’s working correctly.
- Now go to the SharePoint list and check that the records are being inserted correctly.
- Now, test the flow by selecting the “Automatically” option. This will set your flow to run at the scheduled time you set in the recurrence.
- This way, the latest exchange rates will automatically update in your SharePoint list.