Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 175326

vRO - How to save the result of an HTTP Rest to a binary file (zip)

$
0
0

Hi guys

 

I'm trying to save the result of an HTTP rest API request to a mime file but the file result is not correct.

 

I performed a dynamic HTTP request to get the package content:

"vco/api/packages/" + packageName

 

With header

request.setHeader("Accept-Encoding","gzip, deflate")

request.setHeader("Accept", "application/zip")
request.setHeader("Content-Type", "application/zip;charset=utf-8")

 

And get the result by the method "contentAsString" of object "RESTResponse",

 

Then create a mimeFile like :

var mimeAttachment = new MimeAttachment()
mimeAttachment.mimeType = "application/zip"
mimeAttachment.name     = packageName + ".package"
mimeAttachment.content  = response.contentAsString

 

 

I suspect that the "contentAsString" method doesn't support this case.



My goal is to export a vRO package to a file by REST API (I know its possible by PowervRO, but I would like to do this without using a windows Powershell host)

 

 

 

Does anybody has already done this task or does exists a another HTTP plugin to perform this task ?

 

Thanks a lot for your answers

Jacques

 

 


Viewing all articles
Browse latest Browse all 175326

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>