Introduction to universal connectors exercise
Expand your understanding of working with REST universal connectors and working with the data returned.
Exercise overview
Using a Pokemon character in a spreadsheet, call the Poke API through an HTTP connector to gather and post more information on that character.
Steps to follow
Download the CSV file from Workfront.
-
In the Workfront “Fusion Exercise Files” folder, select “_Fusion2020_Shipping Manifest.csv” and click Document Details.
-
Copy the first ID number from the URL address.
-
Create a new scenario in Workfront Fusion. Name it “Using universal connectors.”
-
Start with the Download Document module from the Workfront app.
-
Set up your Workfront connection and include the Document ID you copied from the Workfront URL.
-
Rename this module “Download shipping manifest.”
Parse the shipping manifest data.
-
Add another module, selecting Parse CSV.
-
Set up Parse CSV for 11 columns. Check the CSV contains headers box. Choose the Comma delimiterType, and put Data from the Download Document module in the CSV field.
-
Rename this module “Parse shipping manifest.”
-
Save the scenario and click Run once so you can see data from the CSV file in the next steps.
Get the Pokemon data using the universal connector.
-
Add an HTTP Make a Request module.
-
In the URL field use
https://pokeapi.co/api/v2/pokemon/[Character]
, where [Character] is mapped to Column 3 from the Parse CSV module. -
Select the Parse response check box.
-
Select Show advanced settings and then check the box next to “Evaluate all states as errors.”
-
Click OK and rename the module “Get Pokemon info.”
Your mapping panel should look like this:
In this part of the exercise, you only want to process row 1 in the CSV file.
-
Add a filter before your Get Pokemon info module. Name it “Only row 1.”
-
Set the condition to only allow ID number 1 to pass. ID number 1 is in row 1, and the ID field is in Column 1 in the CSV file.
-
Save the scenario.
-
Click Run Once and observe the error message you receive in the HTTP Make a request module.
note important IMPORTANT Notice in the input data URL field the character name is capitalized. This won’t work for making that API call because character names need to be lowercase. -
Use the mapping panel in the HTTP Make a request URL field to make the [Character] field all lowercase letters using the lower function.
Map information back from the API using the Set multiple variables module.
-
Add the Set multiple variables module after Get Pokemon info. Map name, height, weight, and abilities.
-
Since the Abilities field is an array, remember to use the map function to access the name of each ability in the array.
Run the scenario without the filter to uncover another error.
-
To process all the rows in the CSV file, delete the filter named Only row 1:
- Click the filter icon to edit it.
- Delete the filter label.
- Delete the Condition.
- Click OK.
-
Save the scenario and click Run once.
-
An error occurs in the Get Pokemon info module. You see a superhero character has been passed to the Pokemon API.
note note NOTE In the Routers walkthrough, you’ll see how to resolve this error by creating a separate path to process superheroes.