Access APIs to Boost App Making Possibilities
Accessing APIs, for me, is one of the most interesting things about the internet. There is data available all over that could potentially be useful (or fun) for your next app. In this blog and solution, we are accessing the Open Trivia DB API to bring some simple quiz questions and answers to an app.
There are two parts to the solution:
- A Power Automate flow that, when activated, requests data from the API and passes it back to the app
- The app, that works with the data to display a quiz for the user to try
You can download the Solution file attached to this post, for import into your own environment, so you can play with the functionality.
If you try the API for yourself using this link, you'll get a response similar to this:
{"response_code":0,"results":[{"category":"Entertainment: Television","type":"multiple","difficulty":"medium","question":"What does Bart sell his soul for in The Simpsons episode 'Bart Sells His Soul'?","correct_answer":"$5","incorrect_answers":["A Copy of Bonestorm 2","$100","A Giant Gobstopper"]}]}
It's a bit tough to read on its own, but a tool such as CodeBeautify can make it easier to visualize the hierarchy and contents of the data coming back from the API.
The flow contains just a few simple blocks to get data from this open, unauthenticated API:
Check it out and see how it works!
Some fun API resources that might benefit your next project include:
- Github
- Blogs like this one
- Microsoft Graph API (this one gives access to data that many app makers want to have)
- Some of Microsoft's connectors don't give all the data back accessible from a particular API, for example the routeLegs portion of the response from the BingMaps.GetRoute connector
Have fun!
Bryan
*This post is locked for comments