prova body json

This commit is contained in:
marco.locatelli@steamware.net
2023-09-21 18:01:38 +02:00
parent 50c05dd93a
commit 5a75948d47
+7 -3
View File
@@ -97,15 +97,19 @@ do
$id = $($item.id)
$url = $($item.url)
WriteLogOutput 2 "ID: $id - URL: $url"
#tronco fino a azzano o nembro
$trunk = $url.Remove(0, ($url.Length - 18))
WriteLogOutput 2 "Truncated: $trunk"
#chiamata api con method delete che cancella mirror con id specificato
$callUrlDeleteMirror = "https://gitlab.steamware.net/api/v4/projects/" + $projectCount + "/remote_mirrors/" + $id
Invoke-WebRequest -URI $callUrlDeleteMirror -Method Delete -Headers $head -ContentType "application/json" -UseBasicParsing
#chiamata api con method post che crea mirror con username e token specificati
#$callUrlCreateMirror = "https://gitlab.steamware.net/api/v4/projects/" + $projectCount + "/remote_mirrors"
#$newMirrorUrl = "https://" + $userName + ":" + $tokenAzzano + "@gitlab-azzano.steamware.net" + $trunk
#Invoke-WebRequest -Method Post -URI $callUrlCreateMirror -Headers $head -ContentType "application/json" -UseBasicParsing
$callUrlCreateMirror = "https://gitlab.steamware.net/api/v4/projects/" + $projectCount + "/remote_mirrors"
$newMirrorUrl = "https://" + $userName + ":" + $tokenAzzano + "@gitlab-azzano.steamware.net" + $trunk
$jsonBody
#converto body in json prima di passarlo
Invoke-WebRequest -Method Post -URI $callUrlCreateMirror -Headers $head -ContentType "application/json" -Body -UseBasicParsing
}
}
}