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.
SOLVED

Need Help Sending CSV file via API

Jay2022
8 - Asteroid

Hi,

 

I'm not sure if that is possible but I would like to set a flow where I can send a CSV/Excel file via an API. So I would like for Alteryx to pick up an Excel/csv file, convert it into a 'json' file then upload/POST that file via an API. The trick is, I have to upload each row by themselves with the headers of course ( rows number can go from 3 to 30 depending on the day as the file will be different daily). On a regular basis I should have about 6 to 10 headers on  a regular basis.

 

For the API I have the URL information which include the client_secret,ID and grant_type keys.

 

Any help I can find to  help me build this would be greatly appreciated!!

12 REPLIES 12
CoG
14 - Magnetar

This sounds like a job for either a batch or an iterative macro (I would lean toward iterative myself), but either should work just fine.

Jay2022
8 - Asteroid

How would you proceed with that?

CoG
14 - Magnetar

Here is a general framework based on what I know so far, little details may have to be adjusted as necessary based on your specific requirements (specifically with the Download Tool, and the Tool Container that is currently essentially empty):

Screenshot.png

Jay2022
8 - Asteroid

I beginning to understand it...what would the 2 outpu tools be in this case? a regular output?

CoG
14 - Magnetar

For iterative macros, I follow a standardized system (as an initial note: Iterative Macros require 2 Macro Output Tools for proper functionality).

  1. My first Macro Output Tool (on top) is called Complete and is assigned the anchor initial 'C'. This is the output I use for the successful output of the iterative macro.
  2. My second Macro Output Tool (on bottom) is called Iterate and is not assigned an anchor initial. All records that output here will become the new input for the next iteration (This part is set up in View -> Interface Designer -> Settings)
  3. The macro will thus sample the first record from your data, call the API, and send all other records after the first back through macro until no records remain or the Max Iteration Number is reached (also defined in Interface Settings), which for 30 records should never happen.

More Info. can be found here on iterative macros: https://knowledge.alteryx.com/index/s/article/Getting-Started-with-Iterative-Macros-1583461640389

apathetichell
20 - Arcturus

I don't think this is neccesarily a macro situation - but have you used this API before @Jay2022 or do you just have the credentials? I'd check with postman and figure out the proper syntax for uploads there - FIRST.

After you have the json syntax down (and make sure your credentials work) you'd create a key (ie a rowid) do some transposing, and build a a new datastream of credentials/endpoint/constructed json. then the download tool will execute for each entry that you have.

Jay2022
8 - Asteroid

I am a fair  beginner Alteryx user so the iterate macro sounds a bit challenging for me. I will start working on it and try to fin help to set it up. Thank you for the explanation that will help a lot!!

Jay2022
8 - Asteroid

I have not used the API prior to now. I'm trying to set it up based on what the vendor provided me. So far, once I send the POST resquest it does seem to work per POSTMAN as I received the Ok status. The pretty body gives me an access token, token type, expiration and scope but does not show the file nor data. I need to see the data in the file with both headers and value for each row that is passing through.

 

Is there a way I can do that in POSTMAN?

Jay2022
8 - Asteroid

@CoG , I had a tought, what if I was trying to send out an actual json file but wanted to send one row/case at the time?

Labels
Top Solution Authors