新しい投稿

検索

ダイジェスト
· 2025年6月30日

InterSystems Developers Publications, Week June 23 - 29, 2025, Digest

Articles
Announcements
#InterSystems IRIS
#Summit
#HealthShare
#Developer Community Official
#Health Connect
#InterSystems Official
#TrakCare
Questions
#InterSystems IRIS
HTTP Request not returning data
By Nezla
Convert zone time code in zone number
By Kurro Lopez
Installing NodeJs in the container
By Nezla
Best way to "do this after another class compiles"?
By Justin Millette
Using %Net.WebSocket.Client
By Nezla
How do I set up a virtual environment for Embedded Python in IRIS?
By Justin Millette
Why is temporary database reported smaller than actual size of the disk ?
By Norman W. Freeman
What is best practice for calling macros from Embedded Python?
By Henry Ames
Http Request and Response format from %request object
By Ashok Kumar T
Accessing Response Content in %CSP.REST Before Writing to Output Buffer
By Ashok Kumar T
Identifying System-Defined vs User-Defined Web Applications in IRIS
By Ashok Kumar T
JSON fields and Class properties - are they case sensitive?
By Evgeny Shvarov
#HealthShare
#InterSystems IRIS for Health
#Caché
#Health Connect
Discussions
#Summit
Welcome to Ready 2025!
By Eduard Lebedyuk
June 23 - 29, 2025Week at a GlanceInterSystems Developer Community
お知らせ
· 2025年6月30日

Building HL7 Integrations (3 days) – IN PERSON July 22-24, 2025 / Registration space available

  • Building HL7 Integrations (3 days) – In Person (Boston, MA) July 22-24, 2025
    • Build and configure HL7® V2 interfaces using InterSystems integration technologies
    • This healthcare-focused 3-day course teaches implementation partners, integrators and analysts how to build HL7® integration solutions.
    • Students build a production that processes and routes HL7 messages.
    • Students learn how to work with the pre-built HL7 business services, business processes and business operations to receive and send HL7 messages. Students also learn how to transform HL7 messages using graphical tools in the Management Portal.
    • This course is applicable for users of InterSystems IRIS for Health®, InterSystems Ensemble®, and HealthShare®.
    • Developing custom business services, business processes, and business operations is not addressed in this course.
    • This course does not include specific modules on managing productions. If this is a large part of what you need, refer to the Building and Managing HL7 Integrations course.
ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
質問
· 2025年6月30日

Intersystems Terminal Documentation / Learning Resouces - Cache 2017.1

Can someone point me to learning resources / documentation for Intersystems Terminal? I have scoured YouTube, Intersystems documentation, and the internet. Many of the Object Script commands I found don't work (and that are listed here) do not work in the version of terminal that I have:

https://docs.intersystems.com/ens201817/csp/docbook/DocBook.UI.Page.cls?...

 

So far, I have only found 1 YouTube video that presented commands that 'actually' work my Cache terminal install:

https://www.youtube.com/watch?v=F3lw-2kGY6U&list=PLp4xNHWZ7IQmiSsryS0T3q...

4件の新着コメント
ディスカッション (5)3
続けるにはログインするか新規登録を行ってください
記事
· 2025年6月30日 3m read

Exponer una API REST básica con InterSystems IRIS: Ejemplo paso a paso en Docker

Introducción

InterSystems IRIS permite crear APIs REST utilizando clases ObjectScript y el framework %CSP.REST. Esta funcionalidad permite desarrollar servicios modernos para exponer datos a aplicaciones web, móviles o integraciones externas.

En este artículo aprenderás cómo crear una API REST básica en InterSystems IRIS, incluyendo:

  • Clase de datos persistente
  • Clase REST con métodos GET y POST
  • Web application para exponer la API
  • Demostración completa con Docker

Paso 1: Crear la clase de datos Demo.Producto

Class Demo.Producto Extends (%Persistent, %JSON.Adaptor) {
  Property Nombre As %String;
  Property Precio As %Numeric(10,2);
}
  • %Persistent permite almacenar en la base de datos.
  • %JSON.Adaptor facilita convertir objetos a JSON.

Paso 2: Crear la clase REST Demo.ProductoAPI

Class Demo.ProductoAPI Extends %CSP.REST {

XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ] {
  <Routes>
    <Route Url="/producto" Method="GET" Call="Listar"/>
    <Route Url="/producto" Method="POST" Call="Crear"/>
  </Routes>
}
ClassMethod Listar() As %Status
{
   Try {
    Set productos = []
    &sql(DECLARE C1 CURSOR FOR SELECT ID, Nombre, Precio FROM Demo.Producto)
    &sql(OPEN C1)
    While (SQLCODE=0) {
      &sql(FETCH C1 INTO :id, :nombre, :precio)
      Quit:SQLCODE'=0
      Do productos.%Push({"ID": (id), "Nombre": (nombre), "Precio": (precio)})
    }

    Do ##class(%REST.Impl).%SetContentType("application/json")
    Do ##class(%REST.Impl).%SetStatusCode("200")
    Write productos.%ToJSON()
    } Catch (ex) {
        Do ##class(%REST.Impl).%SetStatusCode("400")
       Write ex.DisplayString()
    }
  Quit $$$OK
}

ClassMethod Crear() As %Status
{
  Try {
    set dynamicBody = {}.%FromJSON(%request.Content)
    Set prod = ##class(Demo.Producto).%New()
    Set prod.Nombre = dynamicBody.%Get("Nombre")
    Set prod.Precio = dynamicBody.%Get("Precio")
    Do prod.%Save()

    Do ##class(%REST.Impl).%SetContentType("application/json")
    Do ##class(%REST.Impl).%SetStatusCode("200")
    Write prod.%JSONExport()
    } Catch (ex) {
        Do ##class(%REST.Impl).%SetStatusCode("400")
       Write ex.DisplayString()
    }
    Quit $$$OK
}

}

Paso 3: Crear una Web Application

Desde el Portal de Administración:

  1. Ir a System Administration > Security > Applications > Web Applications
  2. Crear una nueva aplicación:
    • URL: /api/productos
    • Namespace: USER
    • Clase: Demo.ProductoAPI
    • Activar REST y acceso anónimo para pruebas

para entrar al portal http://localhost:52773/csp/sys/%25CSP.Portal.Home.zen  Usuario=SuperUser Clave=SYS

Agregar la Funciones de aplicacion Developer


Paso 4: Docker de demostración

Estructura del proyecto

apirest-demo/
├── Dockerfile
├── iris.script
└── cls/
    ├── Demo.Producto.cls
    └── Demo.ProductoAPI.cls

Dockerfile

FROM intersystemsdc/iris-community:latest

COPY cls /irisdev/app/cls
COPY iris.script /irisdev/app/iris.script

RUN iris start IRIS \
 && iris session IRIS < /irisdev/app/iris.script \
 && iris stop IRIS quietly

Comandos para construir y correr el contenedor

cd apirest-demo
docker build -t iris-apirest-demo .
docker run -d --name iris-api -p 52773:52773 -p 1972:1972 iris-apirest-demo

Pruebas con Postman o curl

GET productos

curl http://localhost:52773/api/productos/producto

 

POST producto

curl -X POST http://localhost:52773/api/productos/producto \
  -H "Content-Type: application/json" \
  -d '{"Nombre":"Cafe","Precio":2500}'

para descarcar el codigo de ejemplo https://github.com/MarcoBahamondes/apirest-demo

git clone https://github.com/MarcoBahamondes/apirest-demo
ディスカッション (0)1
続けるにはログインするか新規登録を行ってください