Created
May 2, 2019 01:26
-
-
Save marckean/6934cbc3e3a796c3aa0df2678d68c9a2 to your computer and use it in GitHub Desktop.
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
######################################################### | |
####### only works if the Route template is blank ####### | |
######################################################### | |
# QUERY based parameter values - GET method | |
$firstName = 'Marc' | |
$surName = 'Kean' | |
$iwr = Invoke-WebRequest -Uri "https://ejuke2.azurewebsites.net/api/blog?firstname=$firstName&surname=$surName" -Method Get | |
$iwr.content | |
# BODY based parameter values - POST method | |
$firstName = 'Marc' | |
$surName = 'Kean' | |
$postParams = @{"firstname" = $firstName;"surName" = $surName} | ConvertTo-Json | |
$iwr = Invoke-WebRequest -Uri "https://ejuke2.azurewebsites.net/api/blog" -Method POST -Body $postParams | |
$iwr.content | |
######################################################### | |
##### only works if the Route template is NOT blank ##### | |
######################################################### | |
# Route Template: RouteName/{firstname}/{surname} | |
# PARAMS path based parameter values - GET method | |
$firstName = 'Marc' | |
$surName = 'Kean' | |
$iwr = Invoke-WebRequest -Uri "https://ejuke2.azurewebsites.net/api/RouteName/$firstName/$surName" -Method Get | |
$iwr.content | |
# PARAMS path based parameter values - POST method | |
$firstName = 'Marc' | |
$surName = 'Kean' | |
$iwr = Invoke-WebRequest -Uri "https://ejuke2.azurewebsites.net/api/RouteName/$firstName/$surName" -Method POST | |
$iwr.content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment