Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
The Expert Exam is now live online! Read about the specifics and what it took to bring it to life in the blog by our very own Elizabeth Bonnell!

Downloading binary workflow output from Gallery API

5 - Atom

We want to run a gallery workflow from one of our products. The Gallery API fits this need. We're able to start a job with POST /v1/workflows/{appId}/jobs/, see the status of the job with GET /v1/jobs/{jobId}/ and get the output of the job with GET /v1/jobs/{jobId}/output/{outputId}/.


If the output of the job is textual, like a CSV file, and we retrieve it we get the text the file contains. So this works. But now the output of the job is binary, a PDF file. The response we get is still a text while I would expect it to be binary data.


Screenshot 2019-08-30 at 07.20.33.png


Therefore I'm not sure how to interpret this data and write it to the local file system to make it a functional PDF file again. I'm using Node.js and tried decoding the string with all the character encodings currently supported by Node.js but to no avail. The file is always corrupt or empty.


I did some searching on these forums and on Google but the Gallery API examples and explanations I've found don't go into this much detail. They all stop after getting a response from the API.

The format and attachment parameters as described in the API docs don't seem to have any influence on the response.


Can someone point me in the right direction?

Alteryx Certified Partner
5 - Atom

Thanks for the response!


I do see a lot of information about the use of APIs but I do not see specifically what I'm searching for.

There seems to be no description of how to download results to a local file. In the Excel to Alteryx API blog being referenced there is a part which retrieves a textual output but this is something I do have functional in our Node.js application. I am specifically searching for the binary result variant.


Though maybe I just don't see it. I am new to Alteryx and have no knowledge about it and the tools surrounding it aside from the API. And the blog post does a lot with Alteryx itself.

If this is the case, could you kindly tell me in what part to find it?

5 - Atom

After looking around some more and looking into several libraries out there I should be able to set the format of the output and by that influencing what the server returns as the data.


The return value of /v1/jobs/{jobId}/ indicates that the only available format is "Raw". I've tried putting in several values. Most of them are accepted as is but I don't see any change in the output. "pdf" for example is not accepted and gives back following:


  "data": null,
  "exceptionName": "BadRequestException",
  "innerExceptionMessage": "",
  "message": "Requested file format is not supported."
5 - Atom

It works when outputing it into a file or as a blob and then using the blob output tool.