Product: PowerShell Universal
Version: 3.7.3
Can I create an API endpoint where the there are parameters in the URL and a request body is required using the new documentation feature?
I would like something like:
#region PSUHeader
[Documentation()]
class MyObject {
[string] $Name
[string] $Value
}
#endregion
New-PSUEndpoint -Url "/test/:Param1/:Param2" -Method "POST" -Authentication -Endpoint {
<#
.SYNOPSIS
Test endpoint
.INPUTS Param1
First URL param
.INPUTS Param2
Second URL param
.INPUTS
Required: true
Description: Object
Content:
application/json: MyObject
#>
param(
[string]
$Param1,
[string]
$Param2
)
$MyObject = $Body | ConvertFrom-Json
}
Basically, I want a couple params in the URL and a request body, but I don’t want those params listed in Swagger. If I don’t put the $Name and $Value in the param block I get an error when I call the API, if I do put them in there they show up in Swagger as “query” params… which I don’t want. I want them ONLY in the request body.