Does anyone have an example of migrating workflows between Alteryx servers with Powershell 5.1? Specifically, I'm looking for an example of how to format the Multipart/Form-Data request to upload a workflow to the destination server (the Post /admin/v1/workflows/ endpoint).
Solved! Go to Solution.
Hi,
I've done this in Python in Alteryx release 2021.3. I used Python code found here:
https://github.com/Theamazingdp/AlteryxGalleryAPI/blob/master/alteryx_gallery_api_v3_compatible.py
If you can translate to Powershell...
I added this to the above code to get the WF package
#api/admin/v1/{appID}/package/
def getAppAdmin(self, appId):
method = 'GET'
url = self.api_location + '/' + 'admin/v1/' + appId + '/package/'
params = self.build_oauth_params()
signature = self.generate_signature(method, url, params)
params.update({'oauth_signature': signature})
local_filename = 'D:\\Jupyter\\AlteryxAPI\\' + appId + '.yxzp'
# NOTE the stream=True parameter below
with requests.get(url, stream=True, params=params) as yxzp:
yxzp.raise_for_status()
with open(local_filename, 'wb') as f:
for chunk in yxzp.iter_content(chunk_size=8192):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
# f.flush()
Hope that helps.
Thanks for the reply! I'm actually looking for advice on using the /admin/v1/workflows Post endpoint to upload a workflow to one Alteryx server from another. In my script I've successfully been able to check for migratable workflows, download the workflows and reset the migrate flag. What I'm having trouble with is formatting the request to upload the workflows to the new environment after they've been downloaded as a .yxzp file.
Hi,
I'm pretty much at the same point as you. I've gotten all endpoints to work in a Python script except this one. My company is exploring automating implementation but we're just starting. I did find this just now and it may help.
https://documenter.getpostman.com/view/14766220/TzeUmTWD#51daad84-b5ed-4977-bce1-03d8f09f7f7d
Regards,
Tim
We got it working in Postman. We're Server 2021.3, I used Server Admin Key and Secret. We Set SSL Certification to Off.
I have solved this and in short - upgrade to version 2021.3+ and use the oauth 2.0 endpoints.
Authenticating using oauth 2.0 is infinitely simpler than oauth 1.0 and the v3 API endpoints add some great new features. Here's a simple example of using the v3 API to get a list of gallery collections:
$baseaddress = "https://YourServerName/webapi"
$tokenRequestBody = @{
$accessToken = invoke-restmethod -uri $baseaddress/oauth2/token -method POST -body $tokenRequestBody
Thanks for this posting!
I tried this way but it does not work for me - it keeps telling me "Invoke-RestMethod : The remote server returned an error: (401) Unauthorized."
@JosephBih question - for this part-
$tokenRequestBody = @{
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 |