Add-PodeOAResponse
SYNOPSIS
Adds a response definition to the supplied route.
SYNTAX
Schema (Default)
Add-PodeOAResponse -Route <Hashtable[]> -StatusCode <Int32> [-ContentSchemas <Hashtable>]
[-HeaderSchemas <Hashtable>] [-Description <String>] [-Default] [-PassThru] [<CommonParameters>]
Reference
Add-PodeOAResponse -Route <Hashtable[]> -StatusCode <Int32> -Reference <String> [-Default] [-PassThru]
[<CommonParameters>]
DESCRIPTION
Adds a response definition to the supplied route.
EXAMPLES
EXAMPLE 1
Add-PodeRoute -PassThru | Add-PodeOAResponse -StatusCode 200 -ContentSchemas @{ 'application/json' = (New-PodeOAIntProperty -Name 'userId' -Object) }
EXAMPLE 2
Add-PodeRoute -PassThru | Add-PodeOAResponse -StatusCode 200 -ContentSchemas @{ 'application/json' = 'UserIdSchema' }
EXAMPLE 3
Add-PodeRoute -PassThru | Add-PodeOAResponse -StatusCode 200 -Reference 'OKResponse'
PARAMETERS
-ContentSchemas
The content-types and schema the response returns (the schema is created using the Property functions).
Type: Hashtable
Parameter Sets: Schema
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Default
If supplied, the response will be used as a default response - this overrides the StatusCode supplied.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Description
A Description of the response. (Default: the HTTP StatusCode description)
Type: String
Parameter Sets: Schema
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-HeaderSchemas
The header name and schema the response returns (the schema is created using the Property functions).
Type: Hashtable
Parameter Sets: Schema
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PassThru
If supplied, the route passed in will be returned for further chaining.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Reference
A Reference Name of an existing component response to use.
Type: String
Parameter Sets: Reference
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Route
The route to add the response definition, usually from -PassThru on Add-PodeRoute.
Type: Hashtable[]
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-StatusCode
The HTTP StatusCode for the response.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.