> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/it/comandi-powershell/new-psuendpoint.md).

# New-PSUEndpoint

## SYNOPSIS

Crea un nuovo endpoint dell'API REST.

## SYNTAX

### Endpoint

```
New-PSUEndpoint [-Method <String[]>] -Url <String> [-Description <String>] -Endpoint <ScriptBlock>
 [-Path <String>] [-Authentication] [-Role <String[]>] [-RegEx] [-Tag <Tag[]>] [-Timeout <Int32>]
 [-Environment <String>] [-PersistentLog] [-Documentation <String>] [-Module <String>] [-Command <String>]
 [-Credential <String>] [-ComputerGroup <String[]>] [-AvailableInBranch <String[]>] [-Disabled]
 [-ExecutionRole <String[]>] [-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials]
 [-Integrated] [-TrustCertificate] [-Cookies] [<CommonParameters>]
```

### Path

```
New-PSUEndpoint [-Method <String[]>] -Url <String> [-Description <String>] -Path <String> [-Authentication]
 [-Role <String[]>] [-RegEx] [-Tag <Tag[]>] [-Timeout <Int32>] [-Environment <String>] [-PersistentLog]
 [-Documentation <String>] [-Module <String>] [-Command <String>] [-Credential <String>]
 [-ComputerGroup <String[]>] [-AvailableInBranch <String[]>] [-Disabled] [-ExecutionRole <String[]>]
 [-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate]
 [-Cookies] [<CommonParameters>]
```

### Module

```
New-PSUEndpoint [-Method <String[]>] -Url <String> [-Description <String>] [-Authentication] [-Role <String[]>]
 [-RegEx] [-Tag <Tag[]>] [-Timeout <Int32>] [-Environment <String>] [-PersistentLog] [-Documentation <String>]
 -Module <String> -Command <String> [-Credential <String>] [-ComputerGroup <String[]>]
 [-AvailableInBranch <String[]>] [-Disabled] [-ExecutionRole <String[]>] [-ComputerName <String>]
 [-AppToken <String>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]
 [<CommonParameters>]
```

## DESCRIPTION

Crea un nuovo endpoint dell'API REST.

Questo cmdlet è un cmdlet di configurazione. Può utilizzarlo con il sistema di configurazione di PowerShell Universal e con l'API di gestione di PowerShell Universal. Gli endpoint sono archiviati nel file ./universal/endpoints.ps1.

## EXAMPLES

### Esempio 1

```
New-PSUEndpoint -Url "/hello" -Method GET -Endpoint {
    "Hello"
}
PS C:\> Invoke-RestMethod http://localhost:5000/hello
```

Crea un endpoint dell'API REST che restituisce "Hello" quando l'utente lo chiama tramite il metodo HTTP GET.

### Esempio 2

```
New-PSUEndpoint -Url "/hello/:variable" -Method GET -Endpoint {
    $Variable
}

PS C:\> Invoke-RestMethod http://localhost:5000/hello/world
```

Crea un'API REST che utilizza variabili. Le variabili consentono agli utenti di passare dati all'API REST. Appariranno come variabili PowerShell all'interno del blocco di script dell'endpoint.

### Esempio 3

```
New-PSUEndpoint -Url "/hello/" -Method GET -Endpoint {
    "Hello authenticated user"
} -Authentication -Role 'Administrators'

PS C:\> Invoke-RestMethod http://localhost:5000/hello/world -Headers @{ Authorization = "Bearer appTokenGoesHere" }
```

Crea un'API REST che richiede autenticazione e autorizzazione. Solo gli utenti con un AppToken valido possono accedere a questo endpoint e solo gli utenti che detengono il ruolo Administrators.

### Esempio 4

```
New-PSUEndpoint -Url "/hello/" -Method GET -Endpoint {
    "Hello user"
} -ComputerName http://localhost:5000 -AppToken 'appToken'

PS C:\> Invoke-RestMethod http://localhost:5000/hello/world -Headers @{ Authorization = "Bearer appTokenGoesHere" }
```

Crea un'API REST utilizzando l'API di gestione di PowerShell Universal. Quando si chiama l'API di gestione, sarà necessario definire il nome del computer e l'app token per chiamare correttamente l'API.

## PARAMETERS

### -AppToken

L'AppToken utilizzato per chiamare l'API di gestione di PowerShell Universal. Può anche chiamare Connect-PSUServer prima di chiamare questo cmdlet per impostare l'AppToken per l'intera sessione.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Authentication

Specifica se questo endpoint richiede l'autenticazione. L'autenticazione richiede una licenza API.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### -ComputerName

Specifica il nome del computer o l'URL da chiamare quando si accede all'API di gestione di PowerShell Universal. Può anche utilizzare Connect-PSUServer prima di chiamare questo cmdlet per impostare il nome del computer per l'intera sessione.

```yaml
Type: String
Parameter Sets: (All)
Aliases: Uri

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Endpoint

Il contenuto dell'endpoint. Si tratta dello script PowerShell che verrà chiamato quando l'API REST viene eseguita.

```yaml
Type: ScriptBlock
Parameter Sets: Endpoint
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Method

I metodi HTTP richiesti per chiamare questo endpoint.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Accepted values: GET, POST, PUT, DELETE, OPTIONS

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -RegEx

Specifica se elaborare l'URL fornito come stringa RegEx anziché come URL letterale.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### -Role

Specifica il ruolo richiesto per accedere a questo endpoint. Il parametro -Authentication deve essere specificato anche quando si utilizza il parametro -Role. I ruoli richiedono una licenza API.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Url

L'URL dell'endpoint. Questo URL può essere un'espressione RegEx se si specifica il parametro switch -RegEx. Questo URL può anche contenere variabili utilizzando il prefisso due punti (:).

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Description

Una descrizione dell'endpoint da visualizzare nella console.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -UseDefaultCredentials

Utilizzare le credenziali predefinite durante la connessione all'API di gestione

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Integrated

Esegue il comando internamente anziché utilizzare l'API di gestione. Funziona solo quando lo script viene eseguito all'interno di PowerShell Universal.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Tag

Tag per questo endpoint.

```yaml
Type: Tag[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Timeout

Il timeout in secondi per questo endpoint API. 0 o non definito significa nessun timeout.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Path

Il percorso di un file PS1 contenente il contenuto di questo endpoint.

```yaml
Type: String
Parameter Sets: Endpoint
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

```yaml
Type: String
Parameter Sets: Path
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Environment

L'ambiente in cui eseguire questo endpoint.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -PersistentLog

Indica se archiviare il log di questo endpoint nel database.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Documentation

La definizione della documentazione a cui associare questo endpoint.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Command

Il comando che definisce il contenuto di questo endpoint.

```yaml
Type: String
Parameter Sets: Endpoint, Path
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

```yaml
Type: String
Parameter Sets: Module
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Module

Il modulo che contiene il comando che definisce il contenuto di questo endpoint.

```yaml
Type: String
Parameter Sets: Endpoint, Path
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

```yaml
Type: String
Parameter Sets: Module
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ComputerGroup

Il gruppo di computer su cui eseguire questo endpoint.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -AvailableInBranch

Se specificato, l'endpoint sarà disponibile solo nei branch specificati.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Credential

Credenziali per accedere all'API di gestione di PowerShell Universal.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -TrustCertificate

Indica se il cmdlet deve ignorare i problemi relativi ai certificati.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Disabled

Disabilita l'endpoint. L'endpoint non sarà disponibile finché non viene abilitato.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Cookies

Riutilizza e mantiene i cookie di autenticazione per la sessione PowerShell corrente.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ExecutionRole

Specifica uno o più ruoli che possono eseguire la risorsa.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

Questo cmdlet supporta i parametri comuni: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable e -ProgressAction. Per maggiori informazioni, veda [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### Nessuno

## OUTPUTS

### System.Object

## NOTES

## RELATED LINKS

[New-PSUApiResponse](/powershell-universal/it/comandi-powershell/new-psuapiresponse.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/it/comandi-powershell/new-psuendpoint.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
