> 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/es/comandos-de-powershell/new-psuendpoint.md).

# New-PSUEndpoint

## SINOPSIS

Crea un nuevo endpoint de API REST.

## SINTAXIS

### 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>]
```

## DESCRIPCIÓN

Crea un nuevo endpoint de API REST.

Este cmdlet es un cmdlet de configuración. Puede utilizarlo con el sistema de configuración de PowerShell Universal, así como con la API de gestión de PowerShell Universal. Los endpoints se almacenan en el fichero ./universal/endpoints.ps1.

## EJEMPLOS

### Ejemplo 1

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

Crea un endpoint de API REST que devuelve "Hello" cuando el usuario lo llama mediante el método HTTP GET.

### Ejemplo 2

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

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

Crea una API REST que utiliza variables. Las variables permiten a los usuarios pasar datos a la API REST. Aparecerán como variables de PowerShell dentro del bloque de script del endpoint.

### Ejemplo 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 una API REST que requiere autenticación y autorización. Solo los usuarios con un AppToken válido pueden acceder a este endpoint y solo los usuarios que tengan el rol Administrators.

### Ejemplo 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 una API REST utilizando la API de gestión de PowerShell Universal. Al llamar a la API de gestión, deberá definir el nombre del ordenador y el app token para llamar correctamente a la API.

## PARÁMETROS

### -AppToken

El AppToken que se utiliza para llamar a la API de gestión de PowerShell Universal. También puede llamar a Connect-PSUServer antes de llamar a este cmdlet para establecer el AppToken para toda la sesión.

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

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

### -Authentication

Especifica si este endpoint requiere autenticación. La autenticación requiere una licencia de API.

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

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

### -ComputerName

Especifica el nombre del ordenador o la URL a la que se debe llamar al acceder a la API de gestión de PowerShell Universal. También puede utilizar Connect-PSUServer antes de llamar a este cmdlet para establecer el nombre del ordenador para toda la sesión.

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

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

### -Endpoint

El contenido del endpoint. Este es el script de PowerShell que se llamará cuando se ejecute la API REST.

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

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

### -Method

Los métodos HTTP que se requieren para llamar a este 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

Especifica si se debe procesar la URL proporcionada como una cadena RegEx en lugar de como una URL literal.

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

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

### -Role

Especifica el rol que se requiere para acceder a este endpoint. El parámetro -Authentication también debe especificarse al utilizar el parámetro -Role. Los roles requieren una licencia de API.

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

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

### -Url

La URL del endpoint. Esta URL puede ser una expresión RegEx si especifica el parámetro de conmutador -RegEx. Esta URL también puede contener variables utilizando el prefijo de dos puntos (:).

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

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

### -Description

Una descripción del endpoint para mostrar en la consola.

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

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

### -UseDefaultCredentials

Utilizar las credenciales predeterminadas al conectarse a la API de gestión

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

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

### -Integrated

Ejecuta el comando internamente en lugar de utilizar la API de gestión. Solo funciona al ejecutar el script desde dentro de 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

Etiquetas para este endpoint.

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

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

### -Timeout

El tiempo de espera en segundos para este endpoint de API. 0 o no definido significa que no hay tiempo de espera.

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

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

### -Path

La ruta a un fichero PS1 que contiene el contenido de este 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

El entorno en el que ejecutar este endpoint.

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

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

### -PersistentLog

Si se debe almacenar el registro de este endpoint en la base de datos.

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

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

### -Documentation

La definición de documentación con la que asociar este endpoint.

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

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

### -Command

El comando que define el contenido de este 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

El módulo que contiene el comando que define el contenido de este 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

El grupo de ordenadores en el que ejecutar este endpoint.

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

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

### -AvailableInBranch

Cuando se especifica, el endpoint solo estará disponible en las ramas especificadas.

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

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

### -Credential

Credenciales para iniciar sesión en la API de gestión de 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

Si el cmdlet debe ignorar los problemas de certificado.

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

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

### -Disabled

Desactiva el endpoint. El endpoint no estará disponible hasta que se active.

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

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

### -Cookies

Reutiliza y conserva las cookies de autenticación para la sesión actual de PowerShell.

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

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

### -ExecutionRole

Especifica uno o más roles que pueden ejecutar el recurso.

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

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

### CommonParameters

Este cmdlet admite los parámetros comunes: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable y -ProgressAction. Para más información, consulte [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## ENTRADAS

### Ninguna

## SALIDAS

### System.Object

## NOTAS

## ENLACES RELACIONADOS

[New-PSUApiResponse](/powershell-universal/es/comandos-de-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/es/comandos-de-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.
