Introduction to universal connectors walkthrough
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.
Introduction to universal connectors walkthrough
Workfront recommends watching the exercise walkthrough video before trying to recreate the exercise in your own environment.
Transcript
As you begin to build scenarios, you’ll run into situations where Workfront Fusion does not have the app connection to a certain service or platform that you need. However, all hope is not lost because of universal connectors. With the Universal connectors, you can connect to any API system, and perform actions necessary to complete your scenario.
In Workfront Fusion, there are HTTP app connectors which can perform any RESTful call to an endpoint and all of the authentication methods are baked right into the module, which is awesome. There’s also SOAP connectors which can perform actions against a predefined WSDL. There are also email or SMTP connectors which can read, send and manage emails to one of those connectors. And finally, you can read, upload or download files from a standard FTP or SFTP connection.
You can also see that there are basic Auth, OAuth 2.0, client certificate Auth requests, and the ability to get a file using the HTTP connector app.
Let’s start by creating a new scenario in our exercise folder.
We’ll pre-select Workfront, CSV, HTTP and the tools module.
We’ll name this using universal connectors.
We’re going to use Workfront again to download the data file, which we will parse to access each record.
In the Workfront Fusion Exercise files folder, We’ll select Fusion 2020 Shipping Manifest and click on document details. We’ll copy the ID, the first ID. And then back in Fusion, we’ll start with Workfront as our first module and download document. Our connection is still set up from before, I’ll paste the document ID here in the document ID field, click OK, and we’ll rename this module, download shipping manifest.
Now, add another module, parse CSV.
Number of columns, we’ll look at our CSV file, and there are 11 columns here.
CSV contains headers, we’ll leave that, limiter type, we’ll change to Comma, and for CSV file, we’ll use the data from the download document module, and click OK.
I’ll rename this button module parse shipping manifest.
Now, we’ll Save and run once.
So we’ll see some data from our CSV file in our next step.
Next, I’ll choose HTTP, make a request module.
For the URL field, I’ll need to go to the Pokemon API website and copy the URL listed here at the top.
I’ll need to remember to add the Pokemon Forward slash after I put this in to the URL field.
Then the API is going to be looking for the name of the Pokemon at the end of the URL, which is going to be contained in the character column or column three in my CSV file. So I’ll click on column three and add that in. Once I do that, I’ll leave the method is get. The headers, I’ll leave the same, the query string and the body type will be the same, but I’m going to go ahead and click parse response here so that I can automatically get back digestible data from the API website. I’ll also click show advanced settings.
And then I’ll see this option up here at the top, evaluate all states as errors. I’ll select that because we’re going to intentionally throw an error when we run the scenario once. So we’ll go ahead and click okay and rename this module, get Pokemon info.
For the first part of our exercise I only want to process the first row in our CSV file. To do this, I’m going to create a filter after my parse shipping manifest module.
I’ll call this filter only row one and set the condition to only allow the record to pass through if the manifest line ID is equal to one. And that’s this first column here.
Now, we’ll click Save and we’ll run our scenario once to see what type of error I intentionally created on our HTTP module.
Now, let’s run the scenario one time to evaluate the error we intentionally created on our get Pokemon info module. Go ahead and click run once.
If we open the execution inspector, we can see that we received a 404 not found error originating from the HTTP call. With further examination down in the URL field, we can see the call we made had a capital B in a name Bulbasaur.
However, if we look at the Pokemon API, it shows that the character name needs to be all lower case. To fix that, we’re going to go back to our make a request module and we need to wrap our character name by a text or binary function, which takes all the letters between the parentheses and makes them lowercase.
Clicking over in the text and binary functions, we can hover over Lower and see that it will take whatever is within the parentheses and make it all lowercase letters. So we’re going to click on that function and then we’re going to drag column three, right in between here, so it’s between the parentheses.
Let’s go ahead and click OK.
We’ll click Save and then run once again.
In the next video, we’re going to map out some of this information into variables for each character.
To map information back from the Pokemon API, I’m going to use the set multiple variables module at the end of my scenario.
You could also create a CSV file using this data, but for our purpose in this exercise, we’re just going to show you how to do the mapping. You’re going to map the character name, the height, the weight and the abilities as variables.
I can get that information from the get Pokemon info module by clicking into that field.
So I can map over name and height and weight and abilities.
Go ahead and click OK.
We’ll save first and then we’ll run the scenario once more to see what happens in our variables for the first row.
Once it successfully runs, I’ll go and click on my execution inspector and see that we did in fact have the name, the height, the weight and the abilities mapped over. However, as I look at the abilities, it’s collections and collection. In the next video, we’ll show you how to fix this issue.
To fix the issue with our abilities not being mapped over correctly, we’re going to go back into our scenario and return to our set multiple variables module. If I edit my abilities variable and hover over the item that I mapped into, I can see that this is has a data type of an array. So I’ll need to pull the information that I actually want out of the array to map into my variable. Clicking into that field, I can go to the last tab in my mapping panel and find different arrays functions. Hovering over the map function, I can see that I’ll place the array in the first section and after the semicolon, I’ll map directly to the information within the array that I want to grab. Let’s go ahead and select the map function and drag our abilities array into that first section.
As for what to put after the semicolon, I’m going to click back into my items list and realize that within the array, I have a dropdown option that shows me abilities and the name of each ability. So I need to call down into the array for the ability name and I’ll do so by typing in ability.name.
Once I do that, I’ll click Save, OK, And I’ll save my scenario and I’ll click Run once again.
After it executes successfully, let’s look back at our variable and see that we did, in fact, map over the correct ability names. Click on the execution inspector and we can see that we now have Abilities, overgrow and chlorophyll. Let’s try to run the scenario again for all of our Pokemon in the CSV file. To do this, we’ll delete the filter that restricts processing to only one row.
Then I’ll click Save and run once.
We can see that we ran into an error once again with our get Pokemon info module.
Looking into the execution inspector, we can see that it’s the same 404 error, and if we look down at the URL below, we’ll see that one of our superhero names is trying to be used with our Pokemon API call. To fix that, we need to use a router to pass information to different APIs. We’ll learn about how to do this in the next course. -
Exercise URLs
Pokemon API website: https://pokeapi.co/
URL for exercise: https://pokeapi.co/api/v2/pokemon/{Character}
Want to learn more? We recommend the following:
Workfront Fusion documentation
recommendation-more-help
c9fbcf61-6d19-481e-a9ab-f54a0ae0ee8a