Files
testmachine/InvokeWebRequestExample.ps1
luca.mazzoleni 1c53e7f557 test
2024-09-17 18:17:26 +02:00

25 lines
946 B
PowerShell

#creazione nuovo mirror
#compongo url da chiamare per creazione nuovo mirror
$callUrl = "https://liman.egalware.com/ELM.API/api/release/save"
$dateTime = (Get-Date).toString("yyyy-MM-ddTHH:mm:ss.fffZ")
#creo body da convertire in json
$body =
@{
codInst = "EgalWare"
codApp = "TestMachine"
uplAppId = "UpdateManager"
masterKey = "PMmdzvCDsQ8tf3NKRTtXnKSI50/b1iFFjrAfwQlvgK/1o/30sxf+jUUqGYsdQ/Q3"
tipo = "Machine"
versNum = "0.1.2.5"
versText = "0.1B5"
releaseDate = $dateTime
relTags = "DEMO"
}
#converto body in json prima di passarlo alla chiamata POST
$jsonBody = ConvertTo-Json -InputObject $body
#chiamata api POST che crea mirror con url e body specificati
Invoke-WebRequest -Method Post -URI $callUrl -ContentType "application/json" -Body $jsonBody -UseBasicParsing
#conversione da Json della risposta alla chiamata POST
# $parsedRebuild = $rebuildResponse.Content | ConvertFrom-Json