Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

Server API CreateWorkflow issue

danilang
19 - Altair
19 - Altair

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    

Swagger.png

When I try to reproduce this in the Server API tool I always get an "unsupported media type" error.

API Tool.png

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

3 REPLIES 3
apathetichell
19 - Altair

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.

BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@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)

Screenshot 2025-03-18 190725.png

All the best,
BS

LinkedIN

Bulien
danilang
19 - Altair
19 - Altair

Hi @BS_THE_ANALYST 

 

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