It looks like you probably didn't have the ampersand between the URL parameters. So, you went to
http://host:port/rest/v1/threads?asFile=true stackDepth=40 most likely in your browser, when you should have gone to
http://host:port/rest/v1/threads?asFile=true&stackDepth=40 It would have downloaded a json file.
Also, you can place exceptions or logs between three backtick marks, `, to get formatted sections like the following, which are particularly good for stack traces and logs.
Your output here!