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 Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

How to configure multiple API's in Alteryx

spuri5
7 - Meteor

Hello,

 

I have a use case where I have to generate the token first using one URL, and my next step is to copy this token into my second URL to generate the results.

 

I have configured my first URL and generated the token, but the cell has truncated characters. If I were to copy the complete generated token and configure my following URL, how should I do it?

 

Please find attached a screenshot to view my approach. 

 

Appreciate your help!

 

 

 

6 REPLIES 6
patrick_digan
17 - Castor
17 - Castor

Hi @spuri5! If you click on the browse tool instead of the download tool, there's no truncation and you'll get the whole token. If you wanted to automate it, I would use a formula tool to remove the non-token parts (something like replace(replace([YourField],'{"access_token":",""),'"',"")

gyang3
Alteryx
Alteryx

Hi @spuri5 I would recommend dropping a JSON Parse tool in front of the Download tool so you can parse out the access token that's in the DownloadData column. From there, you can prep and blend the data so that you can push it downstream into your second download tool along with your second URL.

 

gyang3_1-1664310524940.png

 

ArtApa
Alteryx
Alteryx
spuri5
7 - Meteor

Hi @gyang3, Thank you for your response!

 

I followed your approach but getting the 401 unauthorized error as shown in the screenshot below. Also, the screenshot provided by you has the formula tool, could you please share what is included inside the formula tool?

 

If my access token values are truncated as highlighted below, when I run my following API's, does that mean it passes only partial values or the full string. Also, is this the reason for my error?

 

Is there a way where access token values are not truncated?

 

 

 

 

spuri5_0-1664475826503.png

 

 

Regards,

Spuri5

 

gyang3
Alteryx
Alteryx

@spuri5 the truncated warning is just saying that not everything is displayed on the screen and if you just try to copy it, you'll only copy the truncated value. However, if you push the value passed downstream or output it somewhere, it will be the full value. One thing you do want to make sure (and I don't believe it should be an issue in this case) is that the size for your access_token field is large enough so that characters are truly not cut off due to insufficient size.

gyang3_0-1664478430070.png

 

The formula tool is to append the word "Bearer" in front of the access token. Typically, you'll make a call to get a token and then use a formula tool to create a new column called Authorization (or in your screenshot "access_token") in which you will append the word "Bearer" in front of the token like so:

gyang3_1-1664478780530.png

 

Lastly, you'll use the Authorization field along with the Endpoint URL to make your API call using a second download tool. You'll select Authorization in the Headers tab in the Download tool configuration panel shown below:

 

gyang3_2-1664478959975.png

 

Again, this may be slightly different depending on what the API documentation is telling you for your specific API call.

 

Let me know if that helps and please mark as solution if so

spuri5
7 - Meteor

Hi @gyang3 ,

I can execute now, appreciate it.

 

Thank you,

Spuri5