Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error returned by POST REST Endpoint when no content-type is specified on Invoke-RestMethod #19

adamdriscoll opened this issue Feb 20, 2018 · 0 comments


None yet
1 participant
Copy link

commented Feb 20, 2018

Import-Module UniversalDashboard

$wsPOST = New-UDEndpoint -Url "/SpireonEvents" -Method POST -Endpoint {
$jsonBody = ConvertFrom-Json $Body

Write-Output ($jsonBody | ConvertTo-Json)

$udws = Start-UDRestApi -Port 1001 -Endpoint @(

$json = (@{FilePath = "code"; Arguments = "script.ps1" } | ConvertTo-Json)
Invoke-RestMethod -Uri 'http://localhost:1001/api/SpireonEvents' -Method POST -Body $json -ContentType 'application/json'
$udws| Stop-UDDashboard
 PS C:\Users\Adam> Invoke-RestMethod -Uri 'http://localhost:1001/api/SpireonEvents' -Method POST -Body $json

@{message=Cannot bind argument to parameter 'InputObject' because it is null.; location=; type=error; id=; refreshIn...

PS C:\Users\Adam> Invoke-RestMethod -Uri 'http://localhost:1001/api/SpireonEvents' -Method POST -Body $json -ContentType

Arguments  FilePath
---------  --------
script.ps1 code

@adamdriscoll adamdriscoll added the bug label Feb 20, 2018

@adamdriscoll adamdriscoll added this to the 1.5.0 milestone Feb 20, 2018

@adamdriscoll adamdriscoll modified the milestones: 1.5.0, 1.5.1 Mar 7, 2018

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.