Basics

Learn the basics of RESTful APIs

Download this Lecture Docs

This is a basic overview of APIs. We will look at the following topics:

  • Creating an API
  • HTTP verbs
  • Route Variables
  • Headers
  • Query String Parameters
  • Body
  • Errors

Example Code from this Lecture

New-PSUEndpoint -Url "/basic" -Endpoint {
  "Hello"
} 
New-PSUEndpoint -Url "/post" -Method "POST" -Endpoint {
  $Body
} 
New-PSUEndpoint -Url "/route/:name" -Endpoint {
  param($name)

  $Name
} 
New-PSUEndpoint -Url "/query" -Endpoint {
  param($FromQuery)
  
  $FromQuery
} 
New-PSUEndpoint -Url "/headers" -Endpoint {
  $Headers
} 
New-PSUEndpoint -Url "/error" -Endpoint {
  Write-Error 'error'
} -ErrorAction "Stop"