Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos
Catch up on one of our webinars
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
362 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
You can find other training resources for the subject of this exercise here:
You can also book hourly online consultancy for your time zone with one of our 7 expert trainers!
| Software ==> | Power Automate (29 exercises) |
| Topic ==> | Working with APIs (3 exercises) |
| Level ==> | Harder than average |
| Subject ==> | Power Automate training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
The aim of this exercise is to send out emails containing trivia questions like this:

This was a "hard" geography question, as you can probably tell (the answer is Indonesia, apparently).
Although getting the API to work is fairly straightforward, the need to shuffle your answers makes this a deceptively hard exercise.
Start by going to https://opentdb.com/api_config.php - a free API giving trivia questions - and configure your requirements (make sure you request multiple choice answers):

Here we've gone for 3 hard geography questions, so will get 3 emails. Be warned that hard means hard!
Write a flow with an HTTP action to visit the URL generated, followed by a Parse JSON action to get the JSON returned:

Your JSON should look like this (although obviously the question and answers will be different).
You now need to make sure that the 3 incorrect answers and the 1 correct one appear in a random order. Power Automate's functions for this are limited, so the best way that Wise Owl could find to do this was as follows:
Step | Details |
|---|---|
Create an array variable | At the start of your flow initialise a variable called Answers, leaving the value blank. This will eventually hold your 4 answers. |
Loop over the questions | Using your JSON as a guide, create an Apply to each loop to loop over the results. |
Within this, loop over the incorrect answers | Within this outer loop create an inner Apply to each loop to loop over the incorrect answers for each question, adding each incorrect answer to your array using the syntax shown after this table. |
Add the correct answer | After finishing the inner loop (but still withIn the outer one) add the correct answer to your array using similar syntax. |
The syntax for adding each incorrect answer to the array should look like this:

Each object in the array has two parts: the answer and a random number using the expression rand(1,100000).
Your Answers array variable should now contain 4 items, giving the answer for each and a random number. Add a Select action to form this array into a two-column table, then another Select action to take this table and sort it:

The second Select action should take the output from the first and sort it by the random sort order.
Create a Compose action to take the single column of answers from this second Select action and join them together into a list, ready for inclusion in your email:

The expression to join the Select items together (with a carriage return between each).
You should now be able to finish and test your flow!
As a refinement, you could always add numbering to the answers ...
You can find other training resources for the subject of this exercise here:
You can also book hourly online consultancy for your time zone with one of our 7 expert trainers!
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Elementa Workspace
6 Bevis Marks
LONDON
EC3A 7BA
c/o Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2026. Registered in England and Wales: company number 05110386.