You get an API! You get an API! Everyone gets an API!
Hey everyone! Welcome back to another installment of our QuickBit series. This time, we’re looking at how to easily utilize APIs in PowerAutomate.
What is an API?
API stands for “Application Programming Interface”. An API acts as a sort of middle man for requests you wish to make to an endpoint. For a deeper understanding, have a look at this link.
The main reason we want to use an API is so we don’t reinvent the wheel. If you can think of something, there’s usually an API for it. Some interesting examples include:
- PokeAPI: https://pokeapi.co/
- The Cocktail DB: https://www.thecocktaildb.com
- GoogleMaps API (we wrote a post on this!): Google Maps in PowerApps – Fast & Efficient
- KayneREST: https://kanye.rest/
Today, we’re going to be picking one from the above list, and one of my personal favourite APIs.
“I’m a creative genius.” – Kanye
Time to build our Flow.
You guessed it, we’re using the Kanye API!
This API will provide you a random Kanye quote when you query it.
HTTP Calls – how to tell the API what to do:
When you query an API, you will be using different methods depending on what you would like to do. The main ones you may use are GET, POST and DELETE.
- GET is used to request data from a specified resource
- POST is used to send data to a server, or to create a resource.
- DELETE is used to delete the specified resource
More information can be found here: HTTP Methods
Can you guess which one we’re going to use?
Implementing the GET method in Flow.
Let’s get into it! What we’ll be doing in this tutorial is setting up a flow that, every day at 8am, will grab a random Kanye quote and post it to yourself in teams! What a way to get motivated for your day.
First, create a new scheduled Flow. Name the flow, and set it to run every morning at 8am:
Click create, and then add a HTTP Step:
Perfect! Now, the “Method” section is where we pick our HTTP method, as described before. Set it to GET, and in the URI add in:
Awesome, well done so far! Lets grab the content that we need and send it to Teams. Add the “Post a message ass the Flow bot to a user” step, and fill it out as so:
We’re almost done! Lets run a test and see what it looks like.
Oooh, so close! That’s okay, I’ll show you how to fix this so it displays just the quote, none of that weird curly brace stuff (which is JSON by the way, check it out here……PowerPlatform and JSON).
Back into Flow, we only need to do one simple thing! In the message section of your “Post a message as the Flow bot to a user” step, set the “Message” to this (make sure you’re in the expressions tab when adding this!):
Wow! Thanks Kanye, I couldn’t have put it better myself.?
Think of the possibilities now! You can use ANY API you want to like this, and pull data into PowerAutomate. And once it’s in PowerAutomate, your options are endless.
Check out some of our other content here:
- PowerApps – Create Beautiful HTML/PDF Reports
- Running SQL Queries in PowerApps
- PowerAutomate – Transforming Lat/Long to an Address
- Google Maps in PowerApps – Fast & Efficient
Jacob | Automation Specialist