I need to create a PowerShell script to upload a file to Archiva repository
I managed to do this by this sample:
$user = "user"
$pass = "password"
$secpass = ConvertTo-SecureString $pass -AsPlainText -Force
$uri = "http:*//X.X.X.X:8080/repository/win/test/test/1.6/test.exe"
$filePath = "x:\x\test.exe"
$cred = New-Object System.Management.Automation.PSCredential ($user, $secpass)
Invoke-RestMethod -Credential $cred -Uri $uri -Method Put -InFile $filePath -ContentType "multipart/form-data"
but it can't create or correct a maven-metadata.xml and a need that for version control. I want it to work like the upload trough Archiva UI.
So maybe somebody can help my with a script for upload using Archiva rest API by PowerShell.
I need to use this services from API
/archivaUiServices/fileUploadService
/fileUploadService/save/{repositoryId}/{groupId}/{artifactId}/{version}/{packaging}
, but don't know the correct way of using them in Powershell
(Managed to reproduce an upload by copping the request caught in fiddler)