Encontrar

Resumen
· 8 ene, 2025

InterSystems Community Q&A Monthly Newsletter #44

Top new questions
Can you answer these questions?
#InterSystems IRIS
Article "Ansible modules and IRIS demo" qlist bug
By Phillip Wu
How does the Inactivity Limit as defined in the System-Wide Security Parameters work and other questions about the login process
By Theo Stolker
UDP Adapter not working
By Corentin Blondeau
Connecting InterSystems IRIS with Metabase BI
By Alex Bravo
Interface Behavior with invalid TLS Cert for 'Server certificate verification'
By James Hipp
Journal not applied to any directory
By Undefined Undefined
Mirror entered trouble state
By Igor Pak
Can't edit %Net.SMTP despite having %DB_IRISSYS and database mounted as RW?
By David Hockenbroch
Admin Portal forbiden
By Thiago Andrade
Need information
By Djouldé BARRY
SSL Issues on Mac OS 15.2 when IRIS is running within a Docker container
By Alastair Maxwell
xDBC error
By Matjaz Murko
MaxRowsToGet on EnsLib.SQL.InboundAdapter
By Scott Roth
The right side of a logical double AND (&&) riddle
By Anthony Master
Converting iris stream to python bytes is very slow
By Jonathan Perry
#InterSystems IRIS for Health
EnsLib.HL7.Service.* through BPL to EnsLib.HL7.MsgRouter.RoutingEngine
By Anthony Master
how to convert from json into sda container and then to fhir bundle resource
By sandeep bhargava
Does Iris for Health Generate Reset Packets? Under What Circumstances? What Settings Are needed in a BS to Not Send Reset packets?
By Patty Aguirre-Romero
Webterminal pagination from command ^%G does not work
By Enric Moya Sánchez
Issue calling methods in jar
By Shashvati Dash
SDA Implementation FHIR
By sandeep bhargava
ERROR #5821: Cannot instantiate query: 'SQLCODE = -146, %msg = Error: '' is an invalid DISPLAY Date value'
By yelena melamed
Troubleshooting unsuccessful Community Edition installation
By Subtropical.Bob
Production pooled component index
By Dmitrii Baranov
Blank jobs due to missing implementation at time of sending deferred response how to clear
By Mark OReilly
#Caché
#Health Connect
#44Monthly Q&A fromInterSystems Developers
Pregunta
· 8 ene, 2025

Can't edit %Net.SMTP despite having %DB_IRISSYS and database mounted as RW?

I need to see the full SMTP trace when a %Net.SMTP attempts to send an email to troubleshoot an issue. As far as I know, the only way to get that is to uncomment line 192 in the %Net.SMTP class.

 //:#define SMTPTRACE

I've done this in the past by giving myself the %DB_IRISSYS role, so I tried that. That database is also not mounted as read-only.

Of course the bigger issue here is that I can't seem to get that trace without having to edit a system class or create my own, but to fix my more immediate issue, what else do I need to check that would be preventing me from editing that class?

7 comentarios
Comentarios (7)5
Inicie sesión o regístrese para continuar
Artículo
· 8 ene, 2025 Lectura de 1 min

2024.3 Interoperability Highlight - New Option to Resend Message from within Visual Trace

The ability to resend messages easily has always been a strong feature of our Interoperability capabilities.

With v2024.3 coming out soon (available already now as Developer Preview) out already we've made this even easier!

Now from within the Visual Trace itself you can find next to the Message Header a Resend button and you can click it and arrive at the usual Resend Message Editor (without having to go through the Message Viewer and search for your specific message).

Here's an example of what this looks like:

See also from the related Release Notes.

2 comentarios
Comentarios (2)3
Inicie sesión o regístrese para continuar
Artículo
· 8 ene, 2025 Lectura de 2 min

¿Cómo y por qué hacer preguntas a la IA de la Comunidad?

Hola desarrolladores:

¿Conoces la IA de la Comunidad? Pues si no es así, te estás perdiendo una de las mejores aplicaciones que nos trajeron en 2024. Y te preguntarás ¿En qué consiste? Pues en una herramienta muy intuitiva para obtener respuestas acerca de la tecnología InterSystems. 

¿Dónde la encuentro? 

 


Al lado derecho de la página, justo encima de la columna de eventos, donde pone "Hacer una pregunta a la IA". Vamos a seguir el paso a paso y verás qué sencillo es.

 

  • Una vez dentro te darás cuenta de que aún está en fase beta. Nuestros compañeros están trabajando en incluir manuales de soporte oficiales y en incorporar el feedback que les vais aportando. Verás un disclaimer que avisa que el contenido que te devuelva bebe de las aportaciones a la Comunidad de Desarrolladores. Esto es genial porque te devolverá hasta el artículo/fuente de la respuesta.

 

  • Cuando hagas tu pregunta, se aportará una respuesta esquematizada, fácil de leer y resumida. Es una buena opción para una primera búsqueda acerca de un tema. Puedes filtrar si la respuesta es de contenido de la comunidad o de la documentación oficial.

   

  • Puedes valorar si la respuesta te ha gustado o no (pulgar arriba o abajo), consultar las fuentes (esto me encanta) y, si eres como yo, quizás sigas prefiriendo ayuda de una persona. Aunque esta herramienta está genial, es complementaria a la ayuda que te ofrecen nuestros expertos. Si quieres contar algo más específico acerca de tu caso, simplemente haz click en "preguntar a la comunidad" y desarrolla tu pregunta sin problemas.

 

  • ¿Ha funcionado la IA en tu caso? Si te ha ayudado, la puedes valorar positivamente. Esto ayuda a seguir mejorando la BETA.

Próximamente iré comentando otras funciones interesantes que tendremos este año en la comunidad, así como ideas y propuestas que podéis incorporar en vuestro día a día para sacar el máximo partido a la tecnología InterSystems.

¡Gracias por leerme!

4 comentarios
Comentarios (4)1
Inicie sesión o regístrese para continuar
Artículo
· 8 ene, 2025 Lectura de 4 min

Creando un cliente REST para obtener canciones de la API REST de Spotify - Parte 1: Comprobad el token

Link de Git: https://github.com/ecelg/InterSystems-IRIS-as-a-Spotify-REST-client

 

Recientemente se me ocurrió una idea: ¿cómo puedo poner mi lista de reproducción en IRIS? 🧐

Al mismo tiempo, me dijeron que debía pagar mi suscripción de Spotify 💸💸... oooh... ¿y si obtengo algunos datos de la API de Spotify? Así que empecé a investigar sobre eso.

Como en la mayoría de los desarrollos, comencemos con la documentación de la API: https://developer.spotify.com/documentation/web-api

Para obtener los datos, se requiere solicitar un token de acceso en la URL del endpoint de token. 🧐

curl -X POST "https://accounts.spotify.com/api/token" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "grant_type=client_credentials&client_id=your-client-id&client_secret=your-client-secret"

Pero antes de eso, debéis comprobar vuestro client_id y client_secret en el Dashboard

creando una aplicación.

entoces

comprobad la api

comprobad la configuración

copiad el client_id y client_secret

 


Vale, todo está listo 😀 Vamos con ello!!!!!😁

1. Configurad una clase Persistent para almacenar la información de la API.

 

sustituir el código como en el siguiente y guardad

Class rest.class.apiinfo Extends (%Persistent, %JSON.Adaptor)
{

Property apiname As %String;
Property clientid As %String(%JSONFIELDNAME = "client_id");
Property clientsecret As %String(%JSONFIELDNAME = "client_secret");
Property granttype As %String(%JSONFIELDNAME = "grant_type");
Property tokentype As %String(%JSONFIELDNAME = "token_type");
Property accesstoken As %String(%JSONFIELDNAME = "access_token", MAXLEN = 200);
Property expiresin As %String(%JSONFIELDNAME = "expires_in");
Property refreshtoken As %String(%JSONFIELDNAME = "refresh_token", MAXLEN = 200);
Property authurl As %String(MAXLEN = 100);
Property authheader As %String(MAXLEN = 100);
Property apiurl As %String(MAXLEN = 100);
Property refreshbefore As %String;
Property updateat As %String;
ClassMethod checkRowid(apiname As %String = "") As %Integer [ Language = objectscript ]
{
	//w ##class(rest.class.apiinfo).checkRowid("Spotify")
	set rtn=0
	set rowid=""
	&sql(select id into :rowid from rest_class.apiinfo where apiname=:apiname )
	//w rowid,!
	if rowid'="" set rtn=rowid
	return rtn
}
}

 

 


2. Insertad la información de la API en la tabla

insertad la información de la api en la tabla

ejemplo SQL

insert into  rest_class.apiinfo
(apiname, apiurl, authurl, clientid, clientsecret, granttype, authheader)
values
('Spotify', 'https://api.spotify.com/v1', 'https://accounts.spotify.com/api/token', 'b43bf136********************', '45ffde***************', 'client_credentials', 'application/x-www-form-urlencoded')

verificadlo

SELECT
ID, accesstoken, apiname, apiurl, authheader, authurl, clientid, clientsecret, expiresin, granttype, refreshbefore, refreshtoken, tokentype, updateat
FROM rest_class.apiinfo

 


3. Configurad un cliente REST para comprobar el token.

Parece que hay varias opciones

Opción 1

Creando operaciones REST en Producción, pero ¿cómo insertar el encabezado "Content-Type: application/x-www-form-urlencoded"? 😓 Dejadme investigar más... Usando el adaptador HTTP Outbound, ok... parece que... necesito revisar más... Usando la respuesta HTTP... ooo lo siento... realmente no lo entiendo porque no hay un ejemplo paso a paso para mí... me rindo. 😭

Opción 2

Python request, parece mucho más fácil de entender, empecemos con la opción 2.

 

3a. Install the requests library

Si necesitáis configurar vuestro propio Python para IRIS después de la versión 2024.3, podéis consultar la guía Flexible Python Runtime para IRIS en Windows Server.

En PowerShell, escribid lo siguiente para instalar la biblioteca requests:

python -m pip install requests

En PowerShell, escribid lo siguiente para instalar la biblioteca iris:

python -m pip install iris

 

3b. Escribid una clase %RegisteredObject para comprobar el token.

Crejad la carpeta utli dentro de la carpeta rest.

cread la clase requestUtli.cls 

escribid la class method checkoutToken 

Class rest.utli.requestUtli Extends %RegisteredObject
{

ClassMethod checkoutToken(apiname = "", withgrandtype = 1) As %String [ Language = python ]
{
	#w ##class(rest.utli.requestUtli).checkoutToken("Spotify")
	import requests
	import json
	import iris
	
	# get the apiinfo object by apiname
	rowid=iris.cls('rest.class.apiinfo').checkRowid(apiname)
	a=iris.cls('rest.class.apiinfo')._OpenId(rowid)
	
	# parameter perparation
	api_baseurl=a.authurl
	params=""
	if withgrandtype==1:
		#print ('grandtype ='+a.granttype)
		params="grant_type="+a.granttype+"&client_id="+a.clientid+"&client_secret="+a.clientsecret
	else:
		#print ('without grandtype')
		params="client_id="+a.clientid+"&client_secret="+a.clientsecret
	contenttype=a.authheader
	headers={"Content-Type":contenttype}
	api_url=api_baseurl+"?"+params
	#print(api_url)
	del a
	
	# post it
	response = requests.post(api_url,headers=headers, verify=False)
	#print(response)
	if response.status_code==200:
		return json.dumps(response.json())
	else:
		return response.status_code
}

}

Guardad el código

 


4. Abrid una terminal para probar si está funcionando o no.

Ejecutad el siguiente comando para realizar la prueba.

w ##class(rest.utli.requestUtli).checkoutToken("Spotify")

¡Síii! ¡El token se ha verificado correctamente! 😁


Comentarios (0)1
Inicie sesión o regístrese para continuar