In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!
Free Trial

Alteryx Server Discussions

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

Inputfile format error using /user/v2/workflows/{{id}}/jobs API

bhaveshamin
5 - Atom

I am trying to follow the API documentation to execute Aleryx Analytical App with File Browser tool to upload a file using i/user/v2/inputfiles/ endpoint.

 

https://help.alteryx.com/developer-help/gallery-api-inputfiles-endpoint

 

I uploaded a file using /user/v2/inputfiles/

and use the file reference Id as input question using /user/v2/workflows/{appId}/jobs/ but I keep getting following error.

 

The Action "Tool #25" has an error: The file "In_649bab54222e00004b005cdc\BodyPart_5fa5987b-71c1-4e42-826b-68052f1fe976" is not a known format. (2) (ToolId: -1)

 

If I run the same App from Gallery, I am able to pass (browse) the file and run it without any issue. I tried multiple tweaks to pass the file name with extension but it doesn't work.

 

I also tried "specifying_inputs_and_outputs.yxzp" from Alteryx tutorial https://community.alteryx.com/t5/Interactive-Lessons/Specifying-Inputs-and-Outputs/ta-p/243111 and its getting the same error.

 

Any help will be really appreciated.

 

Thanks

 

 

 

5 REPLIES 5
bhaveshamin
5 - Atom

The payload looks like following.

 

{{url}}/user/v2/workflows/{{alteryx_workflow_id}}/jobs

 

{
    "questions": [
        {
            "name""File Browse (24)",
            "value""649bab54222e00004b005cdc"
        }    ],
    "priority""High"
}
 
I think the key question is how Alteryx formats the input file ref. Id to In_649bab54222e00004b005cdc\BodyPart_5fa5987b-71c1-4e42-826b-68052f1fe976 and does it need more detail then just file ref. id, like filename and extension. Not sure how it generates the "BodyPart_" part of the file. The In_ part is based on the file ref. Id.
 
Any insight on how the input file ref. Id is being used by "/user/v2/workflows/{{id}}/jobs" wil be really helpful.
Yongcan
8 - Asteroid

You should use below API to post file to gallery and use the return string as file identifer when kick off.

 

POST /user/v2/inputfiles/ Publishes a file to be used in a workflow.
Implementation Notes
Use a MultiPart/Form-Data request to publish a temporary file to be used as an input to an Analytic App. The name of the required form-data section is inputFile.

 

 

bhaveshamin
5 - Atom

Thank you Yougcan. Thats exactly I have done, as you can see the example below.

 

curl --location '<site>/webapi/user/v2/inputfiles/' \
--header 'Authorization: Bearer ...' \
--form 'inputFile=@"<inputfile.csv>

 

After uploading the file, I use the file reference Id into following call.

 

{url}}/user/v2/workflows/{{alteryx_workflow_id}}/jobs

{
    "questions": [
        {
            "name""File Browse (24)",
            "value""649bab54222e00004b005cdc"
        }    ],
    "priority""High"
}
 
And getting following error
 
The Action "Tool #25" has an error: The file "In_649bab54222e00004b005cdc\BodyPart_5fa5987b-71c1-4e42-826b-68052f1fe976" is not a known format. (2) (ToolId: -1)

 

Do you have any working example/workflow for this use case?

 

 

 

Yongcan
8 - Asteroid

You code looks ok to me.

Based on error message the file id always converted to gallery version file path.

 

The Action "Tool #25" has an error: The file "In_649bab54222e00004b005cdc\BodyPart_5fa5987b-71c1-4e42-826b-68052f1fe976" is not a known format. (2) (ToolId: -1)
 
Is your target workfow works fine with file type ( .csv file uploade?) or could you share your sample target workflow?
Gilberto92
5 - Atom

Hi,

Sorry for the late reply—this might still be useful to someone else. The error occurs because you’ve set the Action tool’s connected input tool to “Update Input Data Tool (Default)”. When you use the inputfiles API endpoint, that setting doesn’t populate all the fields the input tool needs to recognize and handle the file correctly (for example, file format, Excel sheet name, and so on).

If you’re using the inputfiles endpoint, switch the Action tool’s setting to “Update Value” on the connected input tool and explicitly define all the file properties beforehand. This ensures the input tool can import and process the file without errors.

When working with an Excel file, you’ll also need to adjust the file‐reference string up through the “.xlsx” extension—leaving intact any sheet specifier that follows. For example: "myData.xlsx|||Sheet1" you need to substitute only the substring "myData.xlsx"

 

 

This works if the sheet name is always the same. If you need the sheet name to be dynamic, unfortunately that endpoint still doesn’t let you specify it directly. In that case, you’ll have to resort to a workaround—either use a text box and perform a replace, or set the input tool’s “List of sheet names” property and select the desired sheet via a dynamic input.