Programmatic Access to External-Service Registry
One can modify Interoperability External-Service Registry in Management Portal (Interoperability > Configure > External-Service Registry).
Can the registry be accessed and modified programmatically?
I don't find much documentation about the subject. Mainly https://docs.intersystems.com/irisforhealth20221/csp/docbook/DocBook.UI....
Product version: IRIS 2022.1
$ZV: IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2022.1.2 (Build 574_0_22161U) Tue Jan 24 2023 11:05:57 EST
This information is found in the class
Ens.ServiceRegistry.External.Service
In my setup no such class exists. The correct class seems to be Ens.ServiceRegistry.External.API. API-class seems to be a mixed bag of public programming interface methods and private implementation ([Internal] methods).
Based on the hint from @Stephen Canzano I figured out the following examples that seems to do the job:
/// How to programmatically access External-Service Registry: /// https://docs.intersystems.com/irisforhealth20221/csp/docbook/DocBook.UI.Page.cls?KEY=EESB_registry_admin#EESB_registry_admin_external Class OSEX.Ex.ExternalServiceRegistry Extends %RegisteredObject { /// list services ClassMethod Ex1() { #dim services // md do ##class(Ens.ServiceRegistry.External.API).ListServices(.services) #dim id as %Integer = $order(services("")) while (id '= "" ) { #dim val as %DynamicObject = {}.%FromJSON($get(services(id))) write "--------------------",! write "#"_id_" Name: "_val.Name,! write "#"_id_" Domain: "_val.Domain,! write "#"_id_" Version: "_val.Version,! write "#"_id_" exists: "_##class(Ens.ServiceRegistry.External.API).ExistsService(val.Name,val.Domain,val.Version),! write "#"_id_" json: "_val.%ToJSON(),! set id = $order(services(id)) } //zw services } /// add/modify service ClassMethod Ex2() { #dim service = ##class(%ZEN.proxyObject).%New() set service.Name = "Foo Service" set service.Domain = "OSEX" set service.Version = "1" set service.Endpoint = "http://localhost:8080/foo" set service.Protocol = "REST" set service.ResponseStyle = "Sync" set service.Stage = "Live" zw service #dim status as %Status = ##class(Ens.ServiceRegistry.External.API).SaveService(service) zw status set service.Name = "Bar Service" set service.Endpoint = "http://localhost:8080/bar" zw ##class(Ens.ServiceRegistry.External.API).SaveService(service) } /// delete service ClassMethod Ex3() { #dim pid as %String = "Foo Service||OSEX||1" #dim status as %String = ##class(Ens.ServiceRegistry.External.API).DeleteService(pid) zw status } }