Server API CreateWorkflow issue
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi
I have a workflow that is using the Server API tool to copy workflows to a server. When I try using Swagger it works
When I try to reproduce this in the Server API tool I always get an "unsupported media type" error.
I've tried various combinations of full path, relative path, with and without extension. Note that I blanked out the userID
Looking at the python code in the tool it looks like it's expecting full path with no extension
def createFiles(file,name):
try:
if file != None:
return [('file', (name+".yxzp", open(file, 'rb'),'application/octet-stream'))]
else:
return ''
except Exception as e:
print(e)
return ''
Any thoughts
Dan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
that looks weird - tbh -I haven't looked at this in 2+ years -> but I'd expect that it wants a full path for the workflow tool's file field. Can you see if name is created somewhere else prior to CreateFiles? The way how CreateFiles is handling file - it should be expecting a full path. In order to use open(file,'rb') - you need a full path - no?
relooking at this -> file should be full path -> name should not include .yxzp extension -> this would be the same in the tool and the swagger. It might be worth opening the swagger in console and seeing what it's sending in.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@danilang I tried the same configuration as you but supplied the full file path with the file extension i.e. C:\Users\benja\Downloads\ServerAPI_Test.yxzp (without quotes). Mine managed to successfully upload. Is there anything I can provide you with, given that my attempt was successful. For what it's worth, I'm using Alteryx Designer 23.2 (Admin) and the version of server is 2024.2.1.73 Patch: 2.
I noticed this in the Server API Tool, I'm not sure if this endpoint is worth trying (if it's available)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The trick it seems is to "Use incoming fields for parameters".
I was originally hard coding the values into the config panel as a test. With hard coded values, no combination full paths, lack of paths and/or extensions worked properly. Once I built the required fields including the full path to the workflow file, and used the fields to map the parameters it was all tickety-boo.
Thanks
Dan
