Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Using an API and OAUTH2

dphipps
6 - Meteoroid

How do you use cURL to move data using Alteryx?  Do you use the Run Command Tool?  I have an API from a vendor and they are using oauth2.  So I have 2 different URLs, one for the authentication and one which has the data I need. They've given me a username and password but no token hence I believe I have to generate a new one each time I want to go get data within the workflow and pass it.   What is the process to get the data?  I know I need to authenticate first right?  And it sounds like that will pass me a one time use token that I need to put into the URL where the data is stored.  I am working with the Text tool and the download tool then I saw information about using cURL.  Thanks in advance for any help getting me started.

12 REPLIES 12
joshuaburkhow
ACE Emeritus
ACE Emeritus

Hey @dphipps 

 

Probably best to start here: https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/APIs-in-Alteryx-cURL-and-Download-T...

 

This will give you a ton of info to start with and then we can go from there once this makes sense 🙂 

 

Let me know if you have more questions! 

 

Joshua

Joshua Burkhow - Alteryx Ace | Global Alteryx Architect @PwC | Blogger @ AlterTricks
BrandonB
Alteryx
Alteryx

For Oauth2 you will use a text input tool and download tool leveraging the authentication endpoint to generate your token. Then you pass the token into a subsequent download tool which calls the reporting endpoint. 

adriansteller
6 - Meteoroid

Hi

 

I'm struggling with this at the moment...

 

The API I'm trying to interact with has has three variants: "Open", "Application" and "User-Restricted". The first two are fine but the third one is killing me and, naturally, is the one I actually need...

 

The "Application" version is what I think you're describing and I've made work with this workflow:

 

Application API Request.PNG

 

(Sounds like the one described by @BrandonB).

 

For the "User-Restricted" version, you need to request an authorisation code which is exchanged for a token that you can included in requests. The problem is that the process for getting the authorisation code requires that the user log into the website, do some additional verification steps and hit a button that will send the authorisation code back.

 

At the risk of being barred from this platform: I can do this successfully in Excel (with the aid of a third party DLL).

 

In the Excel version of this, we make the call which opens the browser to let the user do their bit. Once they hit the button, they are redirected by the website/API to a "localhost" which we designate in the call. Excel is essentially "paused" via an open dialogue box while the user is doing the web bit. When they come back to Excel, they hit "OK" and the process in Excel resumes.

 

TL;DR: Is there a way to have Alteryx open a webpage and capture a code sent back for inclusion in a downstream workflow?

 

Thanks!

BrandonB
Alteryx
Alteryx

@adriansteller the only way I have seen this done is through the use of one of the SDKs for custom application creation. One example is the Google Analytics tool. This is going to be a bit more code heavy than just drag and drop tools, but it is possible. 

 

capture.png

BrandonB
Alteryx
Alteryx

Here is an article outlining exactly what you are referring to: https://community.alteryx.com/t5/Engine-Works-Blog/Authentication-with-the-HTML-GUI-SDK/ba-p/95992

dphipps
6 - Meteoroid

We figured it out using Python embedded in Alteryx using the Python Tool.  We do the authentication and token exchange using Python.

misla003
5 - Atom

@dphipps can you share an example of how you did it with the Python tool?

d1
5 - Atom

Hi dphipps,

 

Can you please share how you achieved the above requirement via Python tool in Alteryx

dphipps
6 - Meteoroid

Sorry for the delay.  I would share the python but when I went back into the workflow for the first time in a long while the python has been deleted!!! Not happy.

Labels