We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

OAuth 2.0 (Bearer) API call using Designer

rickydata
7 - Meteor

So I'm working on a swagger API call (Read) and it uses an OAuth 2.0 (Bearer).

However, there is no direct tool for an API call tool. 

I see we have a download tool but I'm a bit confused on how to set up the connection.  

Since this is an OAuth 2.0, I know I'll the items below, need-which I have:

 

Token URL

Content-Type

Scope

grant type

client id

client secret

 

7 REPLIES 7
abacon
12 - Quasar

@rickydata First, I have built this macro that generates the Bearer tokens for OAuth 2.0 api calls - linked here: Oauth2 Authentication.

Second, setting up an API call within Alteryx is a multi-step process. If you have experience with API calls, what you do in Alteryx is build each piece and format the download tool correctly. You need to pass the URL (with parameters if needed), the Headers, and the body (if applicable). Once here, you will fill out the download tool going tab by tab within it:

Basic: This is where you format the URL section of an API call.

Headers: This is where you format the headers section of the API call.

Payload: This is where you format the body of the API call.

 

My typical process is to use Postman to create the api call, then I will move it to Alteryx using the correct sections to build it.

 

Here is a video on how to setup API calls within Alteryx as well - https://www.youtube.com/watch?v=LQMijJd5y5g

 

Bacon

Showcasing the basics of setting up API calls in Alteryx 1:20 - The Download Tool 3:00 - The Download Tool and Headers 7:10 - Automate the download of multiple pages from an API Previous Video's on API's & Data: API's & Data - What and How? https://youtu.be/UCdTsbxjNyI
apathetichell
20 - Arcturus

@rickydata --- tell us the API you are using --- and we'll help you figure it out.  The API specs are 95% of the time public. Yes --- you will use the download tool (or two) --- and it may be doable depending upon redirects and token endpoints.

 

@abacon fyi --- not always. There's a lot of different nuances for oauth2 --- sometimes the clientid/clientsecret/scope/granttype shows up in the payload/body --- sometimes these are passed in as URL parameters... The core features are the same but how we're passing those in (and if we need additional encoding) --- can totally vary.

abacon
12 - Quasar

@apathetichell For sure, thank you for the correction. I was too absolute with my statement.

 

Bacon

rickydata
7 - Meteor

Here is the spec Docs - DealCloud API Docs.  All this is starting to be very helpful

apathetichell
20 - Arcturus

@rickydata --- that helps.

 

what this means is --- 1) hardcode the header Content-Type in your first download tool -- -set the value as application/x-www-form-urlencoded

 

2) use: a formula tool to create a body with the exact value of:

scope=data%20user_management&grant_type=client_credentials&client_id=106&client_secret=1356GYNU --- with your client id and client secret set up --- note --- if there are any url special characters in any of these values --- you will need to encode them. 

 

3) send it to 

{baseUrl}/api/rest/v1/oauth/token in your download tool --- using POST. 
rickydata
7 - Meteor

So, I found a much different way using this set of documentation Data - DealCloud API Docs, and it works great using the python plugin.  

But now I have find a way to hide the client ID and client secret. 

 

What would be a good way of doing that? 

apathetichell
20 - Arcturus

@rickydata so hypothetically DCM is kind of designed for this ---> but really there isn't what you'd want/hope for as a centralized credential/secret store which then propagates to users at run time. You can do this on your own via cli/boto3 and retrieving an AWS secret value --- or whatever else you do in Python. If you are using python you also could have a local .env file and direct to that for these values. There isn't really a perfect answer here.

Labels
Top Solution Authors