Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploading Zip to Phonegap Using PowerShell Invoke-RestMethod

I'm trying to write a PowerShell script to have a one click solution to uploading and building my mobile application. I have successfully done this using cURL but was trying to use native PowerShell commands instead. In cURL I can use the -F (--form) parameter and pass the zip file (e.g. -F file=@C:...\www.zip). I cannot figure out how to achieve this same thing using PowerShell. I am trying to use Invoke-RestMethod but not sure if this is correct. Here's a link to the PhoneGap API: https://build.phonegap.com/docs/write_api

Any help would much appreciated!

like image 832
justbaum30 Avatar asked Nov 29 '25 05:11

justbaum30


1 Answers

Invoke-RestMethod -Uri https://build.phonegap.com/api/v1/apps/:id -Headers @{Authorization='Basic username-and-password-in-base64'} -Method Put -InFile "www.zip"

username-and-password-in-base64 is your Adobe/PhoneGap Build username and password combined into a string "username:password" and encoded using Base64 (http://www.base64decode.org/).

:id in the url is your app id in phonegap build.

like image 120
klofberg Avatar answered Dec 01 '25 01:12

klofberg