Last active
May 27, 2024 12:18
-
-
Save m0veax/af094c436b228da72070ebd1c370003b to your computer and use it in GitHub Desktop.
Powershell to test a connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create json object | |
$params = @{ ` | |
'element' = 'value' ` | |
} | |
Write-Output "defined parameters" | |
# start dialog to get authentification data | |
$cred = Get-Credential | |
# delete Method, ContentType and Body to do a GET Request | |
# delete Credential to avoid basic authentication | |
$Response = Invoke-WebRequest ` | |
-Uri https://example.com/endpoint ` | |
-Method POST ` | |
-Body ($params|ConvertTo-Json) ` | |
-ContentType "application/json" ` | |
-Credential $cred ` | |
-Verbose | |
Write-Output "started request" | |
$Response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment