Alteryx IO Discussions

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.

Halloween Fortune Challenge: Discover Your Future🎃

baileykaplan
Moderator
Moderator

In this Halloween challenge, you’ll become a master of the mystical arts—by calling a Cloud API. No crystal ball needed— just Postman or a bit of code magic.

 

Call upon the Tarot Card API to draw a card from the deck of fate. Will it predict success, love, or perhaps… something more mysterious?

 

Once you retrieve your card, share the name, its upright meaning, and its reversed meaning. Who knows what fortune (or misfortune) awaits? 🔮

 

There are two options for completing this challenge: using Postman, or JavaScript. If you are new to programming, you might find Postman an easier route, but this can be completed either way!

 

Are you ready to uncover your Halloween fortune? Let’s find out… if you’re brave enough!

 

Option A: Call the Tarot Card API with Postman

  1. Open Postman

    • Download or access the in-browser version here.

  2. Create a new request.

    • Select “New” in the top left hand corner, and then HTTP request.

    • Select GET as your method.

      • A GET request is used to retrieve data from a server (in this case to retrieve a random tarot card from the server).

      • Other common HTTP request types include:

        • POST: Sends data to the server to create or update resources. For example, when you submit a form on a website, it often uses a POST request.

        • PUT: Updates an existing resource with new data. For example, updating an email in a database.

        • DELETE: Removes a specified resource from the server, like deleting an item from a database.

    • Paste in your URL: https://tarotapi.dev/api/v1/cards/random?n=1

      • Note: if you wanted to return multiple cards you could change n=1 to a different number (there are 78 cards in a Tarot deck!).

  3. Send the request by clicking the "Send" button.

  4. Find your fortune in the response!

    • Look for the "name" of your card.

    • Find the "meaning_up" (for an upright card) and "meaning_rev" (for a reversed card).

    Example Response:

    {
        "nhits": 1,
        "cards": [
            {
                "name": "Two of Cups",
                "name_short": "cu02",
                "value": "two",
                "value_int": 2,
                "suit": "cups",
                "type": "minor",
                "meaning_up": "Love, passion, friendship, affinity, union, concord, sympathy, the interrelation of the sexes, and--as a suggestion apart from all offices of divination--that desire which is not in Nature, but by which Nature is sanctified.",
                "meaning_rev": "Lust, cupidity, jealousy, wish, desire, but the card may also give, says W., \"that desire which is not in nature, but by which nature is sanctified.\"",
                "desc": "A youth and maiden are pledging one another, and above their cups rises the Caduceus of Hermes, between the great wings of which there appears a lion's head. It is a variant of a sign which is found in a few old examples of this card. Some curious emblematical meanings are attached to it, but they do not concern us in this place."
            }
        ]
    }

Bonus: your API was automatically formatted with “Pretty” JSON code. Try clicking “Visualize” in Postman and watch it magically format your API call into a table!

 

Option B: Call the Tarot Card API with JavaScript

  1. Set up your local environment

    • First, create a folder for this project. You can name it whatever you want, but I named mine Fortune Teller.

    • Open your favorite IDE. I like Visual Studio Code.

    • Create anindex.html file in your IDE.

  2. Write the code to call the API

    • Open the index.html file. Copy and paste the following code: 

 

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Tarot Card API Fortune</title>
</head>
<body>
   <!-- Text and styling the page -->
  <h1>Reveal Your Halloween Tarot Card!</h1>
  <button id="drawCardButton">Draw a Card</button>
  <p id="cardName"></p>
  <p id="meaningUp"></p>
  <p id="meaningRev"></p>

  <script>
    // Function to call the Tarot Card API
    function drawTarotCard() {
      fetch('https://tarotapi.dev/api/v1/cards/random?n=1')
        .then(response => response.json())
        .then(data => {
          const card = data.cards[0]; // Get the first card
          document.getElementById('cardName').textContent = `Card Name: ${card.name}`;
          document.getElementById('meaningUp').textContent = `Upright Meaning: ${card.meaning_up}`;
          document.getElementById('meaningRev').textContent = `Reversed Meaning: ${card.meaning_rev}`;
        })
        .catch(error => console.error('Error:', error));
    }

    // Add event listener to the button
    document.getElementById('drawCardButton').addEventListener('click', drawTarotCard);
  </script>
</body>
</html>

 

  1. Run the HTML file

    • Save the index.html file.

    • Open the folder where your index.html file is located.

    • Open the file in your web browser (you may need to double click)!

  2. Draw your Tarot Card

    • On the webpage, you’ll see a button labeled "Draw a Card." Click the button, and it will fetch a random tarot card from the API.

    • Below the button, you’ll see the card name, its upright meaning, and its reversed meaning displayed.

 

Now you’ve conjured your Halloween fortune! Share your fortune below to get your Halloween badge.  Keep honing your API skills because we’re brewing up some exciting API improvements. The future is bright, and your Alteryx API wizardry will soon be stronger than ever!

19 REPLIES 19
MeganBowers
Alteryx Community Team
Alteryx Community Team

I got the high priestess! Used the visualize option in Postman--love it!

Screenshot 2024-10-28 at 12.16.55 PM.png

Hub119
11 - Bolide
11 - Bolide

I have received the Six of Wands!

 

Apparently that means either:

 

"The card has been so designed that it can cover several significations; on the surface, it is a victor triumphing, but it is also great news, such as might be carried in state by the King's courier; it is expectation crowned with its own desire, the crown of hope, and so forth." (Upright Meaning)
 
OR
 
"Apprehension, fear, as of a victorious enemy at the gate; treachery, disloyalty, as of gates being opened to the enemy; also indefinite delay." (Reversed Meaning)
 
Here's hoping for the former and not the latter...
Rachel_Zolotov
Alteryx
Alteryx

How fun - I got the Ace of Cups! The visualize option in Postman was a nice view.

Screenshot 2024-10-28 at 3.35.28 PM.png

Mwharron
Alteryx
Alteryx

So fun!  I got the Six of Cups🔮

Screen Shot 2024-10-28 at 3.55.41 PM.png

jpowellsd
Alteryx
Alteryx

Fun challenge,  but couldn't get the Visualize button to work :(  

 

I drew "the Lovers" card

 

card up meaning - Attraction, love, beauty, trials overcome

card down meaning - Failure, foolish designs. Another account speaks of marriage frustrated and contrarieties of all kinds

 

 

AkimasaKajitani
17 - Castor
17 - Castor

 

JavaScript version

 

image.png

 

But I did this Base A.

image.png

 

jpgoodyear
5 - Atom
Screenshot 2024-10-29 091406.png

Four of Wands! Nice!

 

aiahwieder
8 - Asteroid

I got Three of Swords, which seems a bit dark . . .

 

Meaning upright: Removal, absence, delay, division, rupture, dispersion, and all that the design signifies naturally, being too simple and obvious to call for specific enumeration.

 

Meaning reversed: Mental alienation, error, loss, distraction, disorder, confusion.

danboll_life
8 - Asteroid

 I tried it with Alteryx.

スクリーンショット 2024-10-30 164306.png