Ludwig · Jun 24, 2025 go to post

Hi Nezla,

Unfortunately, I don't know if it's possible to achieve what you want by using %Net.HttpRequest. 
If the data is that simple, I'd probably try and handle the HTTP communication manually over TCP.

Please be aware that this is just a quick code snippet, and you'll probably need to refine it further to suit your needs. In the open command you can alter /KEEPALIVE=n to keep the connection alive for n seconds where n>30 and n<432000

randomFunction
 new device,buffer,key,val,iterator
 new url,endpoint,http,headers
 
 set url="stream.wikimedia.org"set endpoint="/v2/stream/recentchange"set headers = {}
 do headers.%Set("Accept","*/*")
 do headers.%Set("Host",url)
 do headers.%Set("User-Agent","TestClient")
 
 set device="|TCP|2"open device:(/HOSTNAME="185.15.59.224":/PORT=443:/SSL="test":/STREAM=1:/KEEPALIVE=30):5if$test=0 {
    write"- Failed to connect"close device
    quit
 }
 
 use device
 
 write"GET "_endpoint_" HTTP/1.0"_$c(13,10),*-3set (key,value,type)=""set iterator=headers.%GetIterator()
 while iterator.%GetNext(.key,.value,) {
    write key_":"_value_$c(13,10),*-3
 }
 write$c(13,10,13,10),*-3// Ignore first messageread buffer:5if$test=0 {
    use0write"- Failed to read anything",!
    zw buffer
    close device
    quit
 }
 
 // Write ":ok" so API begins sending datawrite":ok"_$c(13,10)
 
 read buffer:5use0if$test=0 {
    use0write"- Failed to read anything",!
    zw buffer
    close device
    quit
 }
 
 use0zw buffer
 close device
 quit;

Best regards
Ludwig

Ludwig · Mar 25, 2025 go to post

Hi Fahima,

Perhaps something along these lines will be useful to you (Note: You need to add some more checks, but you get the gist) 

set status=##class(%XML.TextReader).ParseFile(<filepath>,.textreader)
 do textreader.ReadStartElement("content")
 
 while textreader.Read() {
	if (textreader.NodeType="endelement")&&(textreader.Name="content") {
		quit
	}
	
	// Handle values of content element here
 }
Ludwig · Mar 10, 2025 go to post

Hi,

I just tried putting a database as read-only and then executing a dynamic SQL query which worked for me. 
Are you able to provide some more information? For example, the SQL query, any <PROTECT> in the audit log? etc 

Thank you

Ludwig · Mar 10, 2025 go to post

Hi Dmitrii,

The issue stems from the fact that 'su' is designed to run interactively, so it expects a tty to read the password securely. You have to find a way to run a command as another user non-interactively.

If you have the option, you can use 'sudo' with the -S flag instead.
  -S, --stdin                   read password from standard input

Example:

#dim cmd As%String = "echo "_password_" | sudo -S ls"set status = Session.Execute(cmd, .device)
$$$ThrowOnError(status)
       
use device
read response:2use0zwrite response


Otherwise 'expect' might work,
 

expect -c 'spawn su - root -c "ls"; expect "Password :"; send "password\n"; interact
Ludwig · Feb 25, 2025 go to post

Hi John,

Which version of IRIS did you install? Perhaps there is an issue with the webgateway? Have you tried to access the gateway and see if it the configuration is correct? 

http://hostname/csp/bin/Systems/Module.cxw
Ludwig · Mar 12, 2024 go to post

Have you tried running ^STURECOV in %SYS? Might be a problem running the startup routine.