Upload item to repository with REST API via VBScript
According to the REST API documentation for this action, it is needed to pass the file to upload via HTTP POST request: Legacy | Upload Item to Repository
Here is an exmple of how to achieve this via VBScript.
uploadFile.vbs
mcm = "https://<myCloud>.perfectomobile.com/"securityToken = "<mySecurityToken>"repositoryType = "media/"repositoryItemKey = "PRIVATE:apps/Sample.ipa"url = mcm & "services/repositories/" & repositoryType & repositoryItemKey & "?operation=upload"url = url & "&securityToken=" & securityToken
file = "<path\to>\Sample.ipa"set stream = CreateObject("ADODB.Stream")
stream.Mode = 3
stream.Type = 1
stream.Open
stream.LoadFromFile file
request = stream.Read
stream.Close
set HTTP = CreateObject("Msxml2.ServerXMLHTTP.6.0")
HTTP.setOption 2, 13056
HTTP.open "POST", url, false
HTTP.setRequestHeader "Content-Type", "application/octet-stream"HTTP.send request
response = HTTP.responseText
wscript.echo response
set HTTP = nothing
set stream = nothing
wscript.quit
Replace <myCloud> and <mySecurityToken> with the corresponding values;
Change 'repositoryType' and 'repositoryItemKey' parameter values according to your needs. Possible values please see here: Legacy | Repository Operations;
Update the 'file' string with the path to your file for upload;
If needed to add more parameters to the REST API operation as per Legacy | Upload Item to Repository, append it to 'url' string in the form:
url = url & "&<parameter>=" & "<value>"
where you need to replace the <parameter> and <value> accordingly