2 Replies Latest reply on Jul 19, 2017 5:58 AM by pizzle85

    Exporting Content Package via REST through Power-Shell

    pizzle85 Hot Shot

      I'm attempting to script the export and import of content between our vRA environments in Power-Shell. I am having issues downloading the package as a ZIP file from the REST API as described at this link Syntax for Exporting a Package

       

      The command I'm executing is:

       

      Invoke-WebRequest https://vraserver/content-management-service/api/packages/ef43b494-140f-44c3-9ded-3a1a48aa1190 -Headers $header -OutFile .\file.zip
      

       

      This does not work.

       

      A test command that does work is:

       

      Invoke-WebRequest https://github.com/me/dotfiles/archive/master.zip -OutFile .\master.zip
      

       

      I am able to download the file successfully from a Linux machine using the command:

       

      curl --insecure -s -H "Accept: application/zip" -H "Authorization: Bearer $token" https://vraserver/content-management-service/api/packages/ef43b494-140f-44c3-9ded-3a1a48aa1190 -o package.zip
      

       

      I've tried everything i can think of but it looks like the REST API is just returning me some JSON that Power-Shell is sticking into a file not actually grabbing a ZIP file.