Send data in JSON format, specifying the appropriate content-type header

Invoke-WebRequest

  • Performs a HTTP/HTTPS request to the Web.
    This command can only be used through PowerShell.
    More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

Invoke-WebRequest -Body {{'{"name":"bob"}'}} -ContentType 'application/json' {{http://example.com/users/1234}}

click the source code to copy