Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Server Discussions

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

Sending a post request from Alteryx to external API's daily

sschavan
6 - Meteoroid

Hello Alteryx Community!

I'm currently developing a workflow in Alteryx to automate the process of sending a .csv file to a vendor via their API endpoint. Here’s an outline of my approach:

Workflow Overview:

  • Input: We receive a .csv file on our side, which is located on an SFTP server.
  • Objective: Automate the sending of this .csv file to the vendor's API endpoint daily, along with an org_id variable in the request body. Authentication is handled using a bearer token provided by the vendor.

Proposed Workflow Steps:

  1. Using Alteryx Download Tool:

    • Utilize the Download Tool in Alteryx to fetch the .csv file from the SFTP location.
    • Save the file locally to a temporary location, ensuring it’s ready for further processing.
  2. Python Tool for API Integration:

    • Implement a Python Tool within Alteryx to:
    • Construct and send an HTTP POST request to the vendor's API endpoint.
    • Include the downloaded .csv file as part of the request payload, dynamically referencing its file path (utilizing the "Filename from a Field" option in the Download Tool).
    • Incorporate the org_id variable into the request body to meet API requirements.

 

3. Automation and Schedule: The entire workflow will be scheduled to run once a day using Alteryx Scheduler to automate the process of fetching and sending the reports over.


Does this approach sound appropriate? Is there a better way or easier way to do this? Any feedback or suggestions would be greatly appreciated!

Thank you in advance for your insights!

2 REPLIES 2
KGT
11 - Bolide

This looks fine. I'm not sure why you wouldn't just use the download tool to post to the API as well.

 

So, assuming you have some processing steps it would be:

  • Download tool to get csv
  • Other tools to construct payload etc
  • Download tool to upload to API.

 

Of course, there may be reasons to use Python for the POST (MFA bypass etc), and if so, then your method is fine.

 

 

sschavan
6 - Meteoroid

Thank you for your response KGT! Yes, there some reasons due to which we selected a python tool and was able to get this done, Thank you again!