Last active
August 19, 2020 09:04
-
-
Save AvgustPol/6f54d80e4701f35de20f50bab85e308d to your computer and use it in GitHub Desktop.
HTTP POST Powershell send JSON
This file contains hidden or 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
$ExampleVariable1 = "..your data here.."; | |
$ExampleVariable2 = "..your data here.."; | |
$ExampleVariableN = "..your data here.."; | |
$url = 'https://..your url here..'; | |
$requestBody = @{ | |
ExampleVariable1 = '$(ExampleVariable1)' | |
ExampleVariable2 = '$(ExampleVariable2)' | |
ExampleVariableN = '$(ExampleVariableN)' | |
} | |
$json = $requestBody | ConvertTo-Json | |
#POST | |
Invoke-WebRequest -UseBasicParsing $postToDashboardUrl -ContentType "application/json" -Method POST -Body $json | |
#GET | |
Invoke-WebRequest -UseBasicParsing $postToDashboardUrl -ContentType "application/json" -Method GET -Body $json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment