Try to find more information about how to set up API integration between Qualtrics and Alteryx. The content of below link was archived.
Obtained the Data Center ID, Survey Id, Token, Data Endpoint from Qualtrics,
Obtained the progressId and FileId in Postman, created a new GET Request by using the URL (with the Data Center ID, Survey Id and fileId) to check progress and download the file.
The file downloaded is the CSV file. And the URL file link can't be used directly in Alteryx workflow.
My question is How to set up API integration between Qualtrics and Alteryx.
I'd really appreciate any suggestions or help.
To use the provided Python script in the Python Tool in Alteryx, you'll need to follow a few steps to ensure it's integrated properly into your Alteryx workflow. Here's how you can do it:
Steps for Setting Up the Python Tool in Alteryx:
Add Python Tool to Alteryx Workflow:
Install Required Libraries:
To install libraries:
Configure the Python Tool:
Paste the Python Script:
Here's an example of what to paste in the script editor:
import requests import pandas as pd import time import io # Alteryx input (if needed) # If you're passing some inputs from the workflow, you can use: # df = Alteryx.read("#1") # Reading from input data if necessary. # Qualtrics API credentials (replace with your values) API_TOKEN = '<your_api_token>' DATA_CENTER_ID = '<your_data_center_id>' SURVEY_ID = '<your_survey_id>' DOWNLOAD_FILE_ID = '<your_file_id>' BASE_URL = f"https://{DATA_CENTER_ID}.qualtrics.com/API/v3/surveys/{SURVEY_ID}/export-responses/" # Function to start the export process def start_export(): url = f"{BASE_URL}start" headers = { "x-api-token": API_TOKEN, "Content-Type": "application/json" } body = { "format": "csv" } response = requests.post(url, json=body, headers=headers) if response.status_code == 200: progress_id = response.json()['result']['progressId'] print(f"Export started successfully. Progress ID: {progress_id}") return progress_id else: print(f"Error starting export: {response.text}") return None # Function to check the progress of the export def check_progress(progress_id): url = f"{BASE_URL}progress" headers = { "x-api-token": API_TOKEN, "Content-Type": "application/json" } params = { "progressId": progress_id } response = requests.get(url, headers=headers, params=params) if response.status_code == 200: status = response.json()['result']['status'] print(f"Current export status: {status}") if status == 'complete': return True else: return False else: print(f"Error checking progress: {response.text}") return False # Function to download the file once the export is complete def download_file(file_id): url = f"{BASE_URL}file/{file_id}" headers = { "x-api-token": API_TOKEN, "Content-Type": "application/json" } response = requests.get(url, headers=headers) if response.status_code == 200: file_url = response.json()['result']['file']['url'] print(f"File available at: {file_url}") file_response = requests.get(file_url) # Convert the downloaded file content to a Pandas DataFrame file_content = io.StringIO(file_response.text) df = pd.read_csv(file_content) print("File downloaded successfully.") return df # This will be the output DataFrame else: print(f"Error downloading file: {response.text}") return None # Main logic def main(): print("Starting the Qualtrics data export process...") progress_id = start_export() if not progress_id: return None while True: time.sleep(5) # Wait for 5 seconds before checking progress again if check_progress(progress_id): df = download_file(DOWNLOAD_FILE_ID) if df is not None: return df # Return the DataFrame to Alteryx break # Run the main function result_df = main() # Output the DataFrame to Alteryx if result_df is not None: Alteryx.write(result_df, 1) # Writing the result to the first output anchor
Configure Input and Output:
Run the Workflow:
Notes:
Let me know if you need further assistance!
If this solves or leads you in the right direction, please accept this as your solution, thank you.
User | Count |
---|---|
107 | |
85 | |
76 | |
54 | |
40 |