For the complete documentation index, see llms.txt. This page is also available as Markdown.

New-PSUApiResponse

SYNOPSIS

Restituisce una risposta API personalizzata da un'API REST di PowerShell Universal.

SINTASSI

Body (predefinito)

New-PSUApiResponse [-StatusCode <Int32>] [-Body <String>] [-Cookies <Hashtable>] [-ContentType <String>]
 [-Headers <Hashtable>] [<CommonParameters>]

Data

New-PSUApiResponse [-StatusCode <Int32>] [-Cookies <Hashtable>] [-Data <Byte[]>] [-ContentType <String>]
 [-Headers <Hashtable>] [<CommonParameters>]

DESCRIZIONE

Restituisce una risposta API personalizzata da un'API REST di PowerShell Universal. Questo cmdlet deve essere chiamato all'interno del blocco di script -Endpoint definito in New-PSUEndpoint.

ESEMPI

Esempio 1

Restituisce un codice di stato 404 dall'endpoint /hello quando viene chiamato il metodo GET. Questo specifica anche un corpo personalizzato.

PARAMETRI

-Body

Il corpo della risposta da restituire dalla richiesta all'endpoint.

-ContentType

L'intestazione content-type da impostare sulla risposta dell'endpoint.

-Cookies

Una hashtable di cookie da impostare nella risposta HTTP.

-Data

Dati binari da restituire dall'endpoint. Possono essere utilizzati per inviare file binari all'utente.

-StatusCode

Il codice di stato HTTP da impostare per questa risposta. Il valore predefinito è 200.

-Headers

Una hashtable di intestazioni da restituire dalla richiesta API.

CommonParameters

Questo cmdlet supporta i parametri comuni: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable e -ProgressAction. Per maggiori informazioni, consulti about_CommonParameters.

INPUT

Nessuno

OUTPUT

System.Object

NOTE

COLLEGAMENTI CORRELATI

New-PSUEndpoint

Ultimo aggiornamento

È stato utile?