I want to download a file by hitting a rest api.. ...
# getting-started
u
I want to download a file by hitting a rest api.. any suggestions on that? or any tool which i can use? i tried this:
Copy code
@Get("/file/{id}")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
fun downloadFile(@PathVariable("id") fileId: UUID): MutableHttpResponse<ByteArray>? {
    val file = myService.downloadFile(id)
    return HttpResponse.ok(file.content)
        .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=${file.name}")
}