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
Ben1024
5 - Atom

With the JavaScript version I got Wheel Of Fortune,

Upright Meaning: Destiny, fortune, success, elevation, luck, felicity.

Reversed Meaning: Increase, abundance, superfluity.

srh29
5 - Atom

I also couldn't get the visualiser to work but:

 

Five of Wands

 

Upright

"Imitation, as, for example, sham fight, but also the strenuous competition and struggle of the search after riches and fortune. In this sense it connects with the battle of life. Hence some attributions say that it is a card of gold, gain, opulence."
 
Reversed
"Litigation, disputes, trickery, contradiction."
guatepapi
6 - Meteoroid

Type Name Short Name Value Value Int Meaning Up Meaning Rev Description

majorar01The Magician11Skill, diplomacy, address, subtlety; sickness, pain, loss, disaster, snares of enemies; self-confidence, will; the Querent, if male.Physician, Magus, mental disease, disgrace, disquiet.A youthful figure in the robe of a magician, having the countenance of divine Apollo, with smile of confidence and shining eyes. Above his head is the mysterious sign of the Holy Spirit, the sign of life, like an endless cord, forming the figure 8 in a horizontal position . About his waist is a serpent-cincture, the serpent appearing to devour its own tail. This is familiar to most as a conventional symbol of eternity, but here it indicates more especially the eternity of attainment in the spirit. In the Magician's right hand is a wand raised towards heaven, while the left hand is pointing to the earth. This dual sign is known in very high grades of the Instituted Mysteries; it shews the descent of grace, virtue and light, drawn from things above and derived to things below. The suggestion throughout is therefore the possession and communication of the Powers and Gifts of the Spirit. On the table in front of the Magician are the symbols of the four Tarot suits, signifying the elements of natural life, which lie like counters before the adept, and he adapts them as he wills. Beneath are roses and lilies, the flos campi and lilium convallium, changed into garden flowers, to shew the culture of aspiration. This card signifies the divine motive in man, reflecting God, the will in the liberation of its union with that which is above. It is also the unity of individual being on all planes, and in a very high sense it is thought, in the fixation thereof. With further reference to what I have called the sign of life and its connexion with the number 8, it may be remembered that Christian Gnosticism speaks of rebirth in Christ as a change "unto the Ogdoad." The mystic number is termed Jerusalem above, the Land flowing with Milk and Honey, the Holy Spirit and the Land of the Lord. According to Martinism, 8 is the number of Christ.
KirkN
Alteryx Community Team
Alteryx Community Team

Appropriate? Some might say yes! šŸ¤£

Screenshot 2024-10-30 at 5.39.18ā€ÆPM.png

ā€ƒ

CoreySpencerAYX
Alteryx
Alteryx

Super fun exercise. 
I got "Four of Pentacles". 

Bobbyt23
12 - Quasar

I got 'The Moon', very apt for Halloween night.

image.png

perin
8 - Asteroid

Got "six of cups".

 
AaronSmatta
8 - Asteroid

THREE OF SWORDZ

3swordz.png

Shelbey
Alteryx
Alteryx

I got The Hierophant!

 

It means , "Marriage, alliance, captivity, servitude; by another account, mercy and goodness; inspiration; the man to whom the Querent has recourse."

 

OR

 

It means, "Society, good understanding, concord, overkindness, weakness."

 

I don't know much about tarot cards, so I had to find a picture of the card I drew :)

 

RWS_Tarot_05_Hierophant.jpg

seven
12 - Quasar

Six of Cups

A card of the past and of memories, looking back, as--for example--on childhood; happiness, enjoyment, but coming rather from the past; things that have vanished. Another reading reverses this, giving new relations, new knowledge, new environment, and then