1
Clientes
Manuel Aranda Rosales edited this page 2024-08-02 09:15:41 +02:00
Documentación - API ogCore
Select Language / Seleccionar Idioma
English
Table of Contents
Introduction
This documentation describes the configuration of API Platform in a Symfony project. It details the resources, operations, and entity properties exposed through the API.
Configuration
API configuration is done in Symfony configuration files, usually in the config/packages/api_platform.yaml
file.
resources:
App\Entity\Client:
processor: App\State\Processor\ClientProcessor
input: App\Dto\Input\ClientInput
output: App\Dto\Output\ClientOutput
normalizationContext:
groups: ['default', 'client:read']
denormalizationContext:
groups: ['client:write']
operations:
ApiPlatform\Metadata\GetCollection:
provider: App\State\Provider\ClientProvider
filters:
- 'api_platform.filter.client.order'
- 'api_platform.filter.client.search'
- 'api_platform.filter.client.boolean'
ApiPlatform\Metadata\Get:
provider: App\State\Provider\ClientProvider
ApiPlatform\Metadata\Put:
provider: App\State\Provider\ClientProvider
ApiPlatform\Metadata\Patch:
provider: App\State\Provider\ClientProvider
validationContext:
groups: ['client:patch']
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
change_organizational_units:
provider: App\State\Provider\ClientProvider
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\ChangeOrganizationalUnitInput
uriTemplate: /clients/change-organizational-units
controller: App\Controller\ChangeOrganizationalUnitAction
properties:
App\Entity\Client:
id:
identifier: false
uuid:
identifier: true
Resource Definition
App\Entity\Client
- Processor:
App\State\Processor\ClientProcessor
- Input:
App\Dto\Input\ClientInput
- Output:
App\Dto\Output\ClientOutput
- Normalization Context:
['default', 'client:read']
- Denormalization Context:
['client:write']
API Operations
Client Operations
Get Client Collection (GetCollection)
- Provider:
App\State\Provider\ClientProvider
- Filters:
- Order clients:
api_platform.filter.client.order
- Search clients:
api_platform.filter.client.search
- Boolean filter:
api_platform.filter.client.boolean
- Order clients:
Get Client (Get)
- Provider:
App\State\Provider\ClientProvider
Update Client (Put)
- Provider:
App\State\Provider\ClientProvider
Partially Update Client (Patch)
- Provider:
App\State\Provider\ClientProvider
- Validation Context:
['client:patch']
Create Client (Post)
- Default Operation: ~
Delete Client (Delete)
- Default Operation: ~
Change Organizational Units (Post - Custom Operation)
- Provider:
App\State\Provider\ClientProvider
- Class:
ApiPlatform\Metadata\Post
- Method:
POST
- Input:
App\Dto\Input\ChangeOrganizationalUnitInput
- URI Template:
/clients/change-organizational-units
- Controller:
App\Controller\ChangeOrganizationalUnitAction
Entity Properties
App\Entity\Client
-
id:
- Identifier:
false
- Identifier:
-
uuid:
- Identifier:
true
- Identifier:
Client Input DTO
Fields Required in Client Endpoint Input
-
name
- Type: string
- Validation: Not blank
- Groups:
client:write
-
email
- Type: string
- Validation: Email
- Groups:
client:write
-
phoneNumber
- Type: string
- Validation: Not blank
- Groups:
client:write
-
organization
- Type: string
- Validation: Not blank
- Groups:
client:write
Español
Índice
- Introducción
- Configuración
- Definición de Recursos
- Operaciones de API
- Propiedades de la Entidad
- DTO de Entrada de Cliente
Introducción
Esta documentación describe la configuración de API Platform en un proyecto Symfony. Se detallan los recursos, operaciones y propiedades de las entidades expuestas a través de la API.
Configuración
La configuración de la API se realiza en los archivos de configuración de Symfony, generalmente en config/packages/api_platform.yaml
.
resources:
App\Entity\Client:
processor: App\State\Processor\ClientProcessor
input: App\Dto\Input\ClientInput
output: App\Dto\Output\ClientOutput
normalizationContext:
groups: ['default', 'client:read']
denormalizationContext:
groups: ['client:write']
operations:
ApiPlatform\Metadata\GetCollection:
provider: App\State\Provider\ClientProvider
filters:
- 'api_platform.filter.client.order'
- 'api_platform.filter.client.search'
- 'api_platform.filter.client.boolean'
ApiPlatform\Metadata\Get:
provider: App\State\Provider\ClientProvider
ApiPlatform\Metadata\Put:
provider: App\State\Provider\ClientProvider
ApiPlatform\Metadata\Patch:
provider: App\State\Provider\ClientProvider
validationContext:
groups: ['client:patch']
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
change_organizational_units:
provider: App\State\Provider\ClientProvider
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\ChangeOrganizationalUnitInput
uriTemplate: /clients/change-organizational-units
controller: App\Controller\ChangeOrganizationalUnitAction
properties:
App\Entity\Client:
id:
identifier: false
uuid:
identifier: true
Definición de Recursos
App\Entity\Client
- Processor:
App\State\Processor\ClientProcessor
- Input:
App\Dto\Input\ClientInput
- Output:
App\Dto\Output\ClientOutput
- Contexto de Normalización:
['default', 'client:read']
- Contexto de Desnormalización:
['client:write']
Operaciones de API
Operaciones de Cliente
Obtener Colección de Clientes (GetCollection)
- Provider:
App\State\Provider\ClientProvider
- Filtros:
- Ordenar clientes:
api_platform.filter.client.order
- Buscar clientes:
api_platform.filter.client.search
- Filtro booleano:
api_platform.filter.client.boolean
- Ordenar clientes:
Obtener Cliente (Get)
- Provider:
App\State\Provider\ClientProvider
Actualizar Cliente (Put)
- Provider:
App\State\Provider\ClientProvider
Actualización Parcial de Cliente (Patch)
- Provider:
App\State\Provider\ClientProvider
- Contexto de Validación:
['client:patch']
Crear Cliente (Post)
- Operación Predeterminada: ~
Eliminar Cliente (Delete)
- Operación Predeterminada: ~
Cambiar Unidades Organizativas (Post - Operación Personalizada)
- Provider:
App\State\Provider\ClientProvider
- Clase:
ApiPlatform\Metadata\Post
- Método:
POST
- Entrada:
App\Dto\Input\ChangeOrganizationalUnitInput
- Plantilla URI:
/clients/change-organizational-units
- Controlador:
App\Controller\ChangeOrganizationalUnitAction
Propiedades de la Entidad
App\Entity\Client
-
id:
- Identificador:
false
- Identificador:
-
uuid:
- Identificador:
true
- Identificador:
DTO de Entrada de Cliente
Campos Requeridos en la Entrada del Endpoint de Cliente
-
name
- Tipo: string
- Validación: No nulo
- Groups:
client:write
-
email
- Tipo: string
- Validación: Email
- Groups:
client:write
-
phoneNumber
- Tipo: string
- Validación: No nulo
- Groups:
client:write
-
organization
- Tipo: string
- Validación: No nulo
- Groups
Table of Contents
- Select Language / Seleccionar Idioma
- English
- Table of Contents
- Introduction
- Configuration
- Resource Definition
- API Operations
- Entity Properties
- Client Input DTO
- Español