REST API - Sample PS script that can upload and then download a file

Adam,

In the recent announcement video of UA 1.2 that supports REST API, you show an example PS script that received a file from the client script. I wonder if you can provide another example that also shows how to send a file back to the client.

I would like a use case as: (1) Client POST a file to the API (2). UD API receives the file and pass it to Script. (3) Script does “something” to the file i.e. format conversion. (4) Script sends the modified file to the client. (5) Client receives the converted file and stores it in the local disk.

The file can be any format (JPG, PNG, ZIP, DOCX, XLSX, PDF, etc.)

Please advise.

Hey @banyula,

The REST APIs in PSU do not yet support alternate content-types nor do they support file uploads\downloads. We will be adding this in the next version (1.3).

Thanks Adam, I look forward to it.

Hi Adam,

Is file upload and download already supported in 1.3 Universal REST API? I think this is just released, isn’t it?

Please advise

1.3 hasn’t been released yet. You can use a nightly build if you like. That includes the upload and download functionality. 1.3 will be released later this month.

I have seen that 1.3 is already released. Can you provide a sample script for uploading a file through a Rest API, do something with the file at the server, and then downloading the resulting file back to the client? I would appreciate your help on this.

Hi @banyula -

You can find some info and examples on the docs here: https://docs.ironmansoftware.com/api/about#processing-files