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.

REST API Call w Iterative Macro

mystasz
8 - Asteroid

Hi All,

 

I have a python script (attached) that does the below. I am trying to replicate the process in Alteryx and am having no success 

1.Imports necessary tools and setting up some configurations and parameters.

2. Defines a way to extract specific information from a certain type of data format.

3. Triggers a search process in a system using provided details. - HTTP POST 

4. Monitors the progress of the search to know when it's finished. - When run status is DONE, search is done. 

5. Once the search is done, it collects the results using the SID NUMBER. - HTTP GET

6. The main part of the script orchestrates these actions, taking user-supplied information into account. - For now i'm using only USER_ID. 

 

I have the following information

Endpoint URL

API Token

Username 

Password

User_ID

 

I'm trying to replicate this process in Alteryx using the download tool. 

 

1) My first tool is the input tool where I assign the API_TOKEN as a column, the Source_URL as another column and the user_id as another parameter. The value for Source_URL is my endpoint, not the base URL. 

 

2) I link my text input to the Download tool (HTTP POST). Below are my configurations

  • Basic tab:
    • Field = Source_url
    • Encode URL Text is checked 
  • Headers tab:
    • Under 'And values from these fields', I selected API_TOKEN
  • Payload tab:
    • Under 'And values from these fields', I select the user_id column from my text input
    • Under 'Use Following for Query String/Body', I put 'search=|savedsearch%20""' -  Since the workflow is to give me the SID NUMBER for all savedsearches under a specific user_id parameter, blank savedsearch is used. 
  • Connection tab:
    • I entered my username and password

 

It gives the following under "DownloadData"

 

?xml version="1.0" encoding="UTF-8"?
response
sid 1712590550.61122 sid
response

 

It gives the following under "DownloadHeaders"

 

HTTP/1.1 401 Unauthorized
Date: Mon, 08 Apr 2024 15:35:50 GMT
Cache-Control: private
Content-Type: text/xml; charset=UTF-8
X-Content-Type-Options: nosniff
Content-Length: 130
Vary: Cookie, Authorization
Connection: Close
WWW-Authenticate: Basic realm="/splunk"
X-Frame-Options: SAMEORIGIN
Server: Splunkd
Set-Cookie: BIGipServer~INFO-SEC_traffic_grp-2~privacy-dev_https-8089_pool=2840891402.39199.0000; path=/; Httponly; Secure
Strict-Transport-Security: max-age=16070400; includeSubDomains

HTTP/1.1 201 Created
Date: Mon, 08 Apr 2024 15:35:50 GMT
Expires: Thu, 26 Oct 1978 00:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, max-age=0
Content-Type: text/xml; charset=UTF-8
X-Content-Type-Options: nosniff
Link: <1712590550.61122>; rel=info
Content-Length: 92
Location: /servicesNS/alteryx_rest/nyp_privacy_calc_fields/search/jobs/1712590550.61122
Vary: Cookie, Authorization
Connection: Close
X-Frame-Options: SAMEORIGIN
Server: Splunkd
Set-Cookie: BIGipServer~INFO-SEC_traffic_grp-2~privacy-dev_https-8089_pool=2840891402.39199.0000; path=/; Httponly; Secure
Strict-Transport-Security: max-age=16070400; includeSubDomains

 

This is how far I got...I'm assuming I need to create an iterative macro to tell it to keep running until the running state is DONE. Then I can attach another download tool for HTTP GET and extract the results. However, since I have no experience in REST API, I'm not sure how to handle this and why i'm getting a 401 error.

 

The end goal is to get all the data from each savedsearch given a user_id parameter. 

 

Note: 

- I had a call with Alteryx and they mentioned Splunk connection is not supported which is why we're doing REST API call as a workaround. The rep was unsure how to proceed. 

- I've gone through multiple articles in community and have not been able to find something that breaks it down for me. 

0 REPLIES 0
Labels
Top Solution Authors