美国自动化公司的API会给出.xls响应。但是在读取正文为字符串并获取框字符时。有人可以帮我阅读这些字符或将其存储为.xls文件。谢谢。
代码:
Httprequest.Header(“Token”, xYZXxxx).header(“SessionKey”,Xxxxxx),header(“ContentType”,Xxxx);
Requestspecification httpRequest=Null:
Response=HttpRequest.get():
Responsecode= response. Status code;
ResponseValue=Response.Getbody.asstring():
输出:
ResponseCode: 200
ResponseValue= Box Characters(The output is .xls file)
答案 0 :(得分:0)
最后找到了一种保存excel格式API响应的方法。在下面找到解决方案。 代码:
response=httpRequest.get();
FileUtils.writeByteArrayToFile(new File("c:/Folder1/test.xls"),response.body().asByteArray());