I have a web API that gets and downloads a file when the end point is hit. Is there a way to set the download file name to a value that is passed into the web API as a query parameter?
We don't want to permanently rename the actual file itself, just the download file which the user gets when they hit the endpoint.#
Below is what I have so far.
Thanks for any help!
Discussion posts and replies are publicly visible
Could you not run a process model that gets the target file that the user has requested to download and simply makes a copy that is passed back in the body of the response? (you might want the process model to subsequently delete the copy to avoid cluttering up your disk with redundant files)
Thanks Stewart, this could work. Any idea how I can make sure the document is returned before I delete it in the same process?
Hi, yes, it had occurred to me that a race-condition might be set up. As much as I'd like to be able to invoke a second process after the response had been sent by the WebAPI this isn't an option. Here's what you an do:
My go-to pattern is event-driven but I can't see how we can throw such an event in the WebAPI after the httpResponse() step which is the final step of a WebAPI.
Thanks Stewart, this almost works but for some reason my Web API is throwing a 500 error.
I don't see any errors in the process model - any idea what the issue might be here?