Routers walkthrough

Use a router to pass Pokemon vs. superheroes bundles down the correct path, then create a task for each character.

An image of the Fusion scenario

Routers walkthrough

Workfront recommends watching the exercise walkthrough video before trying to recreate the exercise in your own environment.

Transcript
In the last walkthrough exercise, we finished running into an error when we tried to pass superhero information through the Pokemon API.
The purpose of this walkthrough exercise is to teach you about using routers to send bundles of information down correct paths. To be prepared for this walkthrough exercise, you’ll want to have your copy of the shipping manifest CSV file pulled up, the Pokemon API available, the Superhero API available, and you’ll want to generate your access token by using your Facebook account.
The last page you want to have pulled up is your Workfront instance, and you should create an empty project called Shipping Manifest Project.
Let’s start by creating a clone of our last walkthrough exercise and renaming it, creating different paths using routers. Now let’s create a little more working space in the Scenario Designer by zooming out.
I can do this by using my mouse or my mouse pad, and zooming out in the image. I can also click and drag my scenario around in the designer to get the space I need to create a second path for my superheroes. I’m going to start by cloning the Get Pokemon Info module.
I’ll drag it down and then connect it by pulling right here And a router module will automatically appear.
Let’s call this HTTP module Get Superhero Appearance.
Then we’re going to clone the Get Superhero Appearance module again, move it to the right and rename this Get Superhero Abilities.
Let’s clone the tools module and move it to the end of our second path.
To clean up my scenario, I’m going to come down to the toolbar and click on the wand icon or the auto align button.
Now that we’ve cloned the modules above for our superhero path down below, we need to update the URLs on APIs and update the fields that we’re mapping back into our variables. We’ll start with the kit superhero appearance.
If I go to the Superhero API website, I can see under the Appearance section the sample reference call to make.
So I’ll copy this and paste it into this module.
You can see that we’ll need to provide an access token and a character ID here.
Your personal access token can be found at the top of the superhero API page.
You’ll need to use your Facebook account to receive your own token. It’ll generate here and you can go ahead and copy it and then paste it into the URL.
The next thing we need to do is remove the character ID from the URL and replace it with the superhero ID. We’ll take a look at our CSV file, and our superhero ID is here in column one, two, three, four, column four.
Everything else remains the same in this module because we cloned it from above, so go ahead and click OK.
To get superhero abilities, I’m going to go into the Superhero API again and locate the power stats section, which is right here. I’ll copy the URL again and paste it into this module and I’ll need to provide the access token and the character ID again.
Everything else remains the same, so I can go ahead and click OK.
The last module we need to update is our tools module for this. The variable names remain the same but the variable values need to be updated because they’re trying to pull information from an API in a different path. Let’s go ahead and remove these. I’ll edit them one at a time.
Now what we want to do is go to a different API call in this path and grab the name, height, the weight and the abilities. You’ll notice underneath the data section, I don’t have a dropdown to get the specific height and weight or abilities of these, for these two modules.
So what I need to do is click OK for now and then run these two modules separately to gather the information and make it available to do this. I know I’ll run into an error if I simply right click and run this module only. So what I’ll do for this specific example is I’ll click into my module and change the superhero ID right here. So a number that I know will work in this case. So I happen to know that 332 is Hulk’s superhero ID, so I’ll click OK.
Then I click to choose run this module only.
In the Execution Inspector, I can now see that in the data collection there’s a name field and an array for height, an array for weight. Now I can use these in my variables. Let’s do the same thing for the other module.
Looking into the Execution Inspector on the second module, I can see the data collection. I now have intelligence, strength, speed, durability, et cetera, capabilities of this superhero. I’ll go ahead and click out of this.
Now we need to fix our two HTTP modules. We’ll go back and change this 332 to column four.
Go ahead and save this. Now I can click into my variables and I can update the name, the height, the weight, and the abilities.
For abilities, we’re going to have some fun and actually write out a couple of the abilities listed.
For intelligence, start by typing out intelligence, and then I’ll grab the value from the data response.
If I hit Return on my keyboard, then I can type strength and grab that value.
I’ll do one more, and you can do all six if you want.
So I’ll just add speed for now and call it good.
Then click OK and Save.
Now we’re going to add an additional path to our scenario. The third path will create a task within a project for each character in the shipping manifest list. Let’s start by clicking the center of the router.
Once I do that, I’ll click into the center of my empty module and add Workfront.
Create record.
Record type will be task.
Now, if I click in here and use Command or Control + G, I can search for project ID and select that and it will appear down here in the bottom.
Now I’ll go into my Workfront test drive, and hopefully you’ve already created a Shell project called Shipping Manifest Project.
I’ll go ahead and double click on the grid or the Project ID and copy that.
Then I’ll place that in the project ID field.
Next, I want to find the name, so again, Command or Control + G and Control + G again.
There’s the task name.
Now for the task name, I’m going to use the name of the character and then the word from, and then the name of the franchise. So the name of the character is in column three.
We’ll type the word from, and the name of the franchise is column two.
Then click OK, and let’s rename this module create a task for each character.
My scenario’s getting a little messy again, so I’ll click on the auto align button, reorganize my scenario, then I’ll click Save.
To finish this scenario and run without errors, we need to put a filter on each of the first two paths so bundles of information only pass down them if appropriate. For the first, we only want bundles of information to pass down if it applies to the Pokemon API. For the second, the Superhero API. For the third, we have no filter because we want to create a task for each character in the shipping manifest.
Clicking on the dotted line between the router and the Pokemon API module, I’m going to label this character Pokemon character.
For the condition, I’m going to choose the franchise series, which is column two is equal to, and making sure this is text operator equal to Pokemon.
For the superhero path, I’ll click the dotted line and label this superhero character.
And then for the condition, I’d like to do something similar to above, but if I look at the spreadsheet, I can see that superhero characters can be from Marvel Comics or DC Comics or X-Men but I can also see that all of the superheroes have an ID so I’m going to create a different type of condition.
I want to know if the superhero ID, which is in column four exists.
Then click OK. If the superhero ID doesn’t exist, like on our Pokemon rows, then it won’t pass down this path.
So now we’ll go ahead and save our scenario.
Now we’re ready to run our scenario and process all the rows within our CSV file. Let’s click Run once and see what happens.
Okay, let’s make this a little bigger.
We can see that each character in our variable execution inspector shows the name, the height, the weight and the abilities of each of these nine Pokemon characters.
And here we have have 11 of our superheroes that have the name, height, weight and the abilities. The way we spread 'em out there, writing the word in front of each of those different numbers.
And we can see in our Create a Task for each character module that we created 20 tasks in Workfront.
And we can click on our Workfront test drive, refresh the screen, and see the 20 tasks with names, with the character name from, and the franchise. -

Exercise URLs

  • Superhero API website: https://www.superheroapi.com/
  • First URL for exercise: https://www.superheroapi.com/api/{access-token}/{character-id}/appearance
  • Second URL for exercise: https://www.superheroapi.com/api/{access-token}/{character-id}/powerstats

If you have trouble accessing your own superhero token, you can use this shared token: 10110256647253588. Please be considerate of how many times you call to the superhero API so this shared token continues to work for everyone.

Search items in the mapping panel

The Search items field at the top of the mapping panels helps you quickly find fields in the panel, even if they’re nested in arrays. The search is case insensitive.

An image of the first search panel

An image of the second search panel

Tips and tricks for working with APIs

Up to this point, you have worked with a very simple API (Application Programming Interface) that requires no extra authentication to pull information needed in the scenario. Here are a few tips to help you navigate working with APIs and universal connectors.

Step 1: Determine the type of API

Workfront and many software systems are built using a REST (Representational State Transfer) API, which is the easiest and most standard type of API today. However, there are a few others, such as:

  • SOAP (Simple Object Access Protocol) (Workfront’s Proof API is SOAP-based)
  • FTP (File Transfer Protocol)
  • SFTP (Secure File Transfer Protocol)
  • To learn more, do a web search for API types and keywords of interest.
NOTE
When connecting to larger platforms such as Salesforce, different areas of those platforms will provide different APIs. Make sure you find the right one for the service you want to connect to.

Step 2: Determine the type of authentication required by the API

API authentication is a form of identification used to control access to a service, such as when you try to connect through Workfront Fusion. It helps you prove to another system that you are authorized to access the system. OAuth 2 is the most common type of authentication used today. Learn more with an internet search about API authentication.

Authentication can be the most difficult aspect of working with an API. One of the most valuable features of Workfront Fusion’s universal connectors is that Workfront Fusion can handle authentication for you when using common authentication methods like basic authentication, such as OAuth 2, API Key, and others. Once you create a connection using the appropriate Workfront Fusion module for your authentication method (e.g., OAuth 2), Workfront Fusion will continually generate API keys and/or tokens each time you want to run your scenario.

Learn about the different types of authentication that Workfront provides in the Enhanced authentication overview article on Experience League.

Step 3: Read the API documentation and find needed endpoints

When an API interacts with another system, the touchpoints of this communication are considered endpoints. An endpoint is the place where APIs send requests and where the resource lives.

When interacting with an API using a universal connector, you need to understand what endpoints the API supports and what data is required for each request. API documentation should describe an API’s endpoints and how to perform common operations like create, read, update, or delete. Performing these calls requires some practice, especially if you’re new to making API calls or to working with a new API.

Learn more about Workfront Fusion Universal Connectors and how to set them up to connect with the APIs you need on Experience League.

Final note

You can check the entire list of our pre-built app connectors in Experience League. If you would like to suggest a new app connector to the Workfront Fusion product team, submit your idea to Innovation Lab. If you haven’t submitted before, learn more about the Innovation Lab, plus how you can vote for ideas and participate in the twice-a-year Leaderboard prioritization. If you already have access to Innovation lab, log in and submit your ideas.

Your turn

NOTE
Practice exercises and challenges are optional and are not necessary to complete Fusion training.

This practice exercise builds on what you learned in the walkthrough, but the solution is not provided.

In the Set multiple variables module for Pokemon characters, create a variable called “Stat (Level).” Map the name of the Pokemon Stats into this variable. Use the array value capability to change how the array displays, so that each Stat is a new line as shown below.

Hint: There are only six different Pokemon stats with a corresponding level.

An image of Stats

Challenge: See if you can use the array formulas to get the Abilities to display the same way as above as different rows rather than a string of values separated by a comma. There’s a hint in the screenshot below.

An image of an array name

Want to learn more? We recommend the following:

Workfront Fusion documentation

recommendation-more-help
c9fbcf61-6d19-481e-a9ab-f54a0ae0ee8a