Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#########################################################
####### 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
You can’t perform that action at this time.