Dev Space

Customize & extend the power of Alteryx. SDKs, APIs, custom tools, and more!

Python library for Alteryx Gallery API

nick_simmons
5 - Atom

Our team has just published an accessible and easy to use Python library to connect to the Alteryx Gallery API.

 

Check it out at: 

 

https://github.com/Theamazingdp/AlteryxGalleryAPI

 

 

 

Authored by David Pryor and Co-Authored by Nick Simmons and Ritu Gowlikar

13 REPLIES 13
jeffv
8 - Asteroid

Hi,

 

Yes using https://<servername>/gallery/api-docs/ works fine however changing line 31 to https and running it still comes up with the error.  I have reached out to server folks and submitted a support case.

 

Using the api-doc calls seems to work.  I can submit and see status when completed.  However, using the python approach doesn't seem to work. Hmm  not sure what I may be doing wrong.

 

Thanks,

Jeff

joshualherr
Alteryx Alumni (Retired)

We ran into a similar issue with our environments. Our dev environment does not have SSL enabled and I was able to use the Python library to make API calls to our dev environment. But when I repointed to our prod environment which does have SSL enabled, the calls were constantly failing. It took a lot of investigation to finally track down the issue. Apparently, when SSL is not enabled, the endpoint you want to target is '.../gallery/api/v1'. When SSL is enabled, you want to target the endpoint '.../api/v1' (with no /gallery/). Hope this helps!

SeanAdams
17 - Castor
17 - Castor

The Gallery API would really benefit from an end-user accessible wrapper to drop into Alteryx

Thanks for sharing this @nick_simmons 

NeilR
Alteryx Community Team
Alteryx Community Team

A lot of great Python code in the libraries mentioned in this thread, but, unless I missed it, none that explicitly supported the /admin/v1/{appId}/package/ endpoint (which is what I needed and thought I'd share below). JP used the requests_oauthlib package which really makes the code concise.

 

from requests_oauthlib import OAuth1
import requests

base_url = 'https://[your_gallery_url]:[your_port]/api/admin/v1/'
client_key = 'abc'
client_secret = 'xyz'

appId = '5d92671b826fd30b8453779e'
appName = 'Advanced Join'

url = base_url + appId +'/package/'
queryoauth = OAuth1(client_key, client_secret, signature_type='query')
request = requests.get(url, auth=queryoauth)
with open(appName + '.yxzp', 'wb') as f:
    f.write(request.content)