go run cmd/main.go
██╗ ██╗██████╗ █████╗ ██████╗ ███████╗███╗ ██╗████████╗
██║ ██║╚════██╗ ██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝
██║ ██║ █████╔╝ ███████║██║ ███╗█████╗ ██╔██╗ ██║ ██║
╚██╗ ██╔╝ ╚═══██╗ ██╔══██║██║ ██║██╔══╝ ██║╚██╗██║ ██║
╚████╔╝ ██████╔╝ ██║ ██║╚██████╔╝███████╗██║ ╚████║ ██║
╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝
🚀 Advanced AI Assistant with Semantic Search & Function Calling
💬 Just start chatting or type 'help' for commands
You: como puedo leer clientes.
Agent: Según la documentación, puede obtener la lista de clientes usando el siguiente endpoint:
GET https://[host]/api/model/customer
Características importantes:
- Autenticación requerida:
- Header "key": [su API key]
- Header "tenant": [su tenant]
- Paginación:
- Por defecto devuelve 20 resultados por página
- Puede usar el parámetro "limit" para ajustar resultados (20-100)
- Para obtener la siguiente página use "lastId"
- Filtrado (opcional):
- Use el parámetro "search" para filtrar resultados
- Ejemplo para buscar por nombre:
GET https://[host]/api/model/customer?search=["name","=","valor"]
- Selección de campos (opcional):
- Use el parámetro "fields" para especificar qué campos retornar
- Ejemplo para obtener solo nombre y email:
GET https://[host]/api/model/customer?fields=["name","email"]
Los campos principales disponibles incluyen:
- id
- name (nombre completo)
- firstName (nombre)
- lastName (apellido)
- phone
- taxNumber (número fiscal)
- address (campos: street, city, zipCode, etc.)
¿Necesita información específica sobre algún aspecto de la API de clientes?
You: dame un ejemplo en curl para buscar clientes que se llamen pedro o juan o maría.
Agent: Basado en la documentación, aquí tienes un ejemplo de curl para buscar clientes que se llamen Pedro, Juan o María:
curl -H "key: [apiKey]" \
-H "tenant: [tenant]" \
"https://[host]/api/model/customer?search=[\"OR\",[\"firstName\",\"=\",\"Pedro\"],[\"firstName\",\"=\",\"Juan\"],[\"firstName\",\"=\",\"María\"]]"Notas importantes:
- Necesitarás reemplazar [apiKey], [tenant] y [host] con tus credenciales reales
- El ejemplo usa el campo "firstName" que es el nombre de pila
- La búsqueda usa el operador "OR" para combinar las tres condiciones
- La URL debe estar correctamente codificada en una situación real
Si prefieres buscar en el nombre completo (que podría incluir apellidos), puedes usar el campo "name" en lugar de "firstName":
curl -H "key: [apiKey]" \
-H "tenant: [tenant]" \
"https://[host]/api/model/customer?search=[\"OR\",[\"name\",\"=\",\"Pedro\"],[\"name\",\"=\",\"Juan\"],[\"name\",\"=\",\"María\"]]"You: y que su fecha de creación sea anterior al año pasado.
Agent: Here is the curl example modified to search for customers named Pedro, Juan or María AND whose creation date is before last year (2023):
curl -H "key: [apiKey]" \
-H "tenant: [tenant]" \
"https://[host]/api/model/customer?search=[\"AND\",
[\"OR\",[\"firstName\",\"=\",\"Pedro\"],[\"firstName\",\"=\",\"Juan\"],[\"firstName\",\"=\",\"María\"]],
[\"createdAt\",\"<\",\"2023-01-01T00:00:00Z\"]
]"Important notes:
- I've added an "AND" operator to combine both conditions
- The date "2023-01-01T00:00:00Z" represents the beginning of last year
- The "<" operator means "less than" (before)
- The "createdAt" field is typically used for creation date
- The URL should be properly encoded in a real situation
- You'll need to replace [apiKey], [tenant] and [host] with your actual credentials
If you prefer to use the "name" field instead of "firstName" to search in the full name:
curl -H "key: [apiKey]" \
-H "tenant: [tenant]" \
"https://[host]/api/model/customer?search=[\"AND\",
[\"OR\",[\"name\",\"=\",\"Pedro\"],[\"name\",\"=\",\"Juan\"],[\"name\",\"=\",\"María\"]],
[\"createdAt\",\"<\",\"2023-01-01T00:00:00Z\"]
]"