<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Alteryx Gallery API - Downloading Packages as a non-Admin/Curator in Alteryx Server Discussions</title>
    <link>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-API-Downloading-Packages-as-a-non-Admin-Curator/m-p/1137445#M13372</link>
    <description>&lt;P&gt;Hey All! I am working on a migration project and looking for a way as a non-Admin/Curator to mass download packages given a list of Workflow IDs. I've been looking at the /v1/ endpoints and it looks like as an Artisan I can use /v1/workflows/{appId}/package. Does anyone have an example script or workflow that uses that endpoint? I'm struggling to get the right GET request to download the .yzxps. &lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what chatGPT is suggesting but it returns a 401. This is what chatGPT is suggesting but it returns a 401.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import requests
import os

# Define the Alteryx Server URL and workflow ID
server_url = "https://myalteryxserver.com"
# update code to feed in a list, but testing with one workflow ID for now
workflow_id = "12345"

# Specify the path to save the downloaded workflow package on the C drive
save_path = "C:/workflow.yxzp"

# Alteryx Server authorization token
auth_token = mytoken

# Construct the API endpoint URL
api_url = f"{server_url}/api/v1/workflows/{workflow_id}/package"

# Send a GET request to download the workflow package
headers = {'Accept': 'application/octet-stream',"Authorization": f"{auth_token}"}
response = requests.get(api_url, headers=headers, stream=True, verify=False)

# Check if the request was successful
if response.status_code == 200:
    # Create the directories in the save path if they don't exist
    os.makedirs(os.path.dirname(save_path), exist_ok=True)

    # Open a file in binary mode and save the downloaded package
    with open(save_path, "wb") as file:
        for chunk in response.iter_content(chunk_size=8192):
            file.write(chunk)
    print("Workflow package downloaded successfully!")
else:
    print("Failed to download the workflow package.")&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 23 May 2023 23:35:18 GMT</pubDate>
    <dc:creator>mcha54</dc:creator>
    <dc:date>2023-05-23T23:35:18Z</dc:date>
    <item>
      <title>Alteryx Gallery API - Downloading Packages as a non-Admin/Curator</title>
      <link>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-API-Downloading-Packages-as-a-non-Admin-Curator/m-p/1137445#M13372</link>
      <description>&lt;P&gt;Hey All! I am working on a migration project and looking for a way as a non-Admin/Curator to mass download packages given a list of Workflow IDs. I've been looking at the /v1/ endpoints and it looks like as an Artisan I can use /v1/workflows/{appId}/package. Does anyone have an example script or workflow that uses that endpoint? I'm struggling to get the right GET request to download the .yzxps. &lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what chatGPT is suggesting but it returns a 401. This is what chatGPT is suggesting but it returns a 401.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import requests
import os

# Define the Alteryx Server URL and workflow ID
server_url = "https://myalteryxserver.com"
# update code to feed in a list, but testing with one workflow ID for now
workflow_id = "12345"

# Specify the path to save the downloaded workflow package on the C drive
save_path = "C:/workflow.yxzp"

# Alteryx Server authorization token
auth_token = mytoken

# Construct the API endpoint URL
api_url = f"{server_url}/api/v1/workflows/{workflow_id}/package"

# Send a GET request to download the workflow package
headers = {'Accept': 'application/octet-stream',"Authorization": f"{auth_token}"}
response = requests.get(api_url, headers=headers, stream=True, verify=False)

# Check if the request was successful
if response.status_code == 200:
    # Create the directories in the save path if they don't exist
    os.makedirs(os.path.dirname(save_path), exist_ok=True)

    # Open a file in binary mode and save the downloaded package
    with open(save_path, "wb") as file:
        for chunk in response.iter_content(chunk_size=8192):
            file.write(chunk)
    print("Workflow package downloaded successfully!")
else:
    print("Failed to download the workflow package.")&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 23 May 2023 23:35:18 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-API-Downloading-Packages-as-a-non-Admin-Curator/m-p/1137445#M13372</guid>
      <dc:creator>mcha54</dc:creator>
      <dc:date>2023-05-23T23:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Alteryx Gallery API - Downloading Packages as a non-Admin/Curator</title>
      <link>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-API-Downloading-Packages-as-a-non-Admin-Curator/m-p/1139875#M13402</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.alteryx.com/t5/user/viewprofilepage/user-id/34713"&gt;@mcha54&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your server version is 21.4 or higher, I suggest using the following set of macros and building your own workflow.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.alteryx.com/t5/Engine-Works/Introducing-the-Alteryx-Server-v3-API/ba-p/899228" target="_blank"&gt;https://community.alteryx.com/t5/Engine-Works/Introducing-the-Alteryx-Server-v3-API/ba-p/899228&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I`m not experienced with python, but you are using a hard-coded token which could work if you are getting the token somewhere. Here is the endpoint for the token.&amp;nbsp;&lt;A href="https://help.alteryx.com/20223/server/server-api-configuration-and-authorization" target="_blank"&gt;https://help.alteryx.com/20223/server/server-api-configuration-and-authorization&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Fernando Vizcaino&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 18:31:50 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-API-Downloading-Packages-as-a-non-Admin-Curator/m-p/1139875#M13402</guid>
      <dc:creator>fmvizcaino</dc:creator>
      <dc:date>2023-05-29T18:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Alteryx Gallery API - Downloading Packages as a non-Admin/Curator</title>
      <link>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-API-Downloading-Packages-as-a-non-Admin-Curator/m-p/1141909#M13429</link>
      <description>&lt;P&gt;Thank you for the link! I did start using those Server macros, but run into the same issue. Only Admins/Curators can authenticate and use a bulk of the API calls including the one that downloads a package. Is there something that non-Admin/non-Curators can do?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2023 21:36:24 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-API-Downloading-Packages-as-a-non-Admin-Curator/m-p/1141909#M13429</guid>
      <dc:creator>mcha54</dc:creator>
      <dc:date>2023-06-01T21:36:24Z</dc:date>
    </item>
  </channel>
</rss>

