Hi @Julian Matthews

The Ens.StreamContainer class is a %Persistent class and it stores the different types of stream in it. So, If you delete the row/record by id / or by query it will delete the entry as well as the stream contents(it's also part of the row) from the Ens.StreamContainer table. So, be cautious before deleting the container. %OnDelete  callback method is used to do some additional function while deleting the object.

Hello @Nezla,

The %SYS.Task class has the task details which includes the status of the task. The "Suspended" column has value if incase the task is errored out while running ("Suspend Leave" ) or the task is suspended ("Suspend Reschedule"). Based on this column you can find out the suspended /errored task. Use the below query for the TaskName and additional details.

select Name,Status,TaskClass,Suspended from %SYS.Task

Hello  @Michael Wood,

here are several approaches you can take to handle this. One option is to create a file service that reads the file as a stream and sends it to a custom business process. You can then convert that stream into a JSON object and iterate through each DynamicObject entry. Alternatively, you could send the stream to BPL and process the JSON there

Simplified sample of process the JSON. 


Class Samples.Introp.JSONFileService Extends Ens.BusinessService
{

Parameter ADAPTER = "EnsLib.File.InboundAdapter";

Method OnProcessInput(pInput As %Stream.Object, Output pOutput As %RegisteredObject) As %Status
{
	Do ..SendRequestSync("JSONFileProcess",pInput,pOutput)
	Quit $$$OK
}

}

Class Samples.Introp.JSONFileProcess Extends Ens.BusinessProcess [ ClassType = persistent ]
{

Method OnRequest(pRequest As Ens.Request, Output pResponse As Ens.Response) As %Status
{
	Set json = {}.%FromJSON(pRequest)
	
	Set iter = json.%GetIterator()
	
	while iter.%GetNext(.key,.val)
	{
		s ^test($Classname(),$NOW(),key)=val.%ToJSON()
	}

	Quit $$$OK
}
}

Thanks!

Hello @Krishnaveni Kapu 

%SYS.Task is responsible for store, suspend and resume for all the tasks. so, your can execute the below method programmatically to achieve it. It expects the task id as the first argument

You can execute the below query to get the task id, name and additional information

select Suspended,Name,id from %SYS.Task

suspend

Flag

1 - Suspend the task, but leave it in task queue (default)
2 - Suspend the task, remove from task queue, and reschedule for next time

Set taskId = 1001
Set flag = 2
Write ##class(%SYS.Task).Suspend(taskId,flag)

resume

Set taskId=1001
Write ##class(%SYS.Task).Resume(taskId)

Hello @Ali Chaib

FHIR to SDA

Yes we have built in transformation class available to FHIR ⇆ SDA and HS.FHIR.DTL.Util.API.Transform.FHIRToSDA3 is used to convert to SDA3 to FHIR
If you're goal to to convert to FHIR to SDA object then "HS.FHIR.DTL.Util.HC.SDA3.FHIR.Process" use this Business Process(BP) class to convert but this will send the request to BO again based on the BP configuration. Otherwise programmatically construct the input and pass the required values to the method in TransformStream class transformation class(which is in FHIR to SDA conversion business process) HS.FHIR.DTL.Util.API.Transform.SDA3ToFHIR for convert FHIR to SDA

SDA3 to HL7 conversion

There is no method for programmatically converting from SDA to HL7 v2.

  from documentation. So, You  need to read the JSON response, extract the required information, and transform it directly into an HL7 message

There are multiple DTL's available for SDA3 to HL7 v2 in package "HS.Gateway.SDA3.SDA3ToHL7." Can you check and utilize if it's helps

Thanks!

As you know the swagger is used to design the API documentation first, and then build the REST API based on that design. IRIS or other API systems don't inherently know about the payload, the return response, or the specific responses for status codes like 200, 400, or 500 unless it's specified.

You're right about the traditional approach. Creating REST services manually doesn't have knowledge of these details. It generates the Swagger documentation based on the information available in the UrlMap and the class method in the dispatch class. Add your comments on top of the class method (meta data details) will be set into the description in swagger

 
Spoiler

If you want your API to be well-documented, it’s better to follow a spec-first approach, as this approach captures crucial details like paths, method types, descriptions, path parameters, query parameters, and responses.

Thanks!

Hello @Yone Moreno 

Try this below input in your DTL. Because the property Informes as a list so you have to create the xml data like below  Property Informes As list Of EsquemasDatos.DragoAP.Portal360.Informes(XMLNAME = "Informes");

You can create a main object and set all the properties and use obj.XMLExportToString(.xmlString) for the xml structure of the class object. That will be helpful for forming the input  for DTL as well.

<InformeVisitaRequest>
	<Paciente>
		<NumExpediente>12</NumExpediente>
		<Informes>
			<Informes>
				<Fecha_Creacion>tescreation</Fecha_Creacion>
				<Id_Visita>tesVistia</Id_Visita>
				<Titulo>tesTitulo</Titulo>
				<Desc_Tipo_Plant>Desc_Tipo_Plant</Desc_Tipo_Plant>
				<NumExpediente>1212</NumExpediente>
			</Informes>
		</Informes>
	</Paciente>
</InformeVisitaRequest>

Thanks!

Hello @Martin Nielsen 

Quick note, You can get the manually created web applications via /v1/{namespace}/restapps in the web application "/api/mgmnt" ex: http://localhost:52773/api/mgmnt/v1/learning/restapps. This will list down all the v1 applications and from that you can use the web app name to get the openAPI(swagger 2.0) by using the the url /v1/{namespace}/spec/{web app name} ex: http://localhost:52773/api/mgmnt/v1/learning/spec/dc/samprest

Hello @Martin Nielsen

I did some analysis about this. As of my understanding, I found this is because of the method DispatchRequest in the %CSP.REST. The below piece of code is actually skip your accountId due to forward your request to another "DispatchRequest" in the other dispatch class(for your case "AnotherController" class). But these are rewritten in IRIS already. You can try override this method for testing.

Set tMatchUrl=$Piece(tMatchUrl,tMatchcher.Group(1),"2",*),tForward=$LisGet(tMapEntry,3)
Actual Url: /1001/anothercontroller/001
Url after above line executed: /001

Hello @Sylvie Greverend

The sample swagger for produces "image/jpeg" and consumes "application/json" and "application/xml" for sample. Once the spec.cls. Once it's complied it creates a "DownloadImg" classmethod in .disp.cls

swagger

{
	"swagger": "2.0",
	"info": {
		"title": "test",
		"version": "1.0.0"
	},
	"paths": {
		"/Test": {
			"get": {
				"summary": "Test download",
				"operationId": "DownloadImg",
				"produces": [
					"image/jpeg"
				],
				"consumes": [
					"application/json",
					"application/xml"
				]
			}
		}
	}
}

Generated class method

ClassMethod DownloadImg() As %Status
{
    Try {
        Do ##class(%REST.Impl).%SetContentType("image/jpeg")
        If '##class(%REST.Impl).%CheckAccepts("image/jpeg") {
            Try {
                Do ##class(MyLearn.LearnREST.Swag.impl).%ReportRESTError(..#HTTP406NOTACCEPTABLE,$$$ERROR($$$RESTBadAccepts))
            } Catch {
                Do ##class(%REST.Impl).%ReportRESTError(..#HTTP406NOTACCEPTABLE,$$$ERROR($$$RESTBadAccepts))
            }
            Quit
        }
        Set response=##class(MyLearn.LearnREST.Swag.impl).DownloadImg()
        Do ##class(MyLearn.LearnREST.Swag.impl).%WriteResponse(response)
    } Catch (ex) {
        Try {
            Do ##class(MyLearn.LearnREST.Swag.impl).%ReportRESTError(..#HTTP500INTERNALSERVERERROR,ex.AsStatus(),$parameter("MyLearn.LearnREST.Swag.impl","ExposeServerExceptions"))
        } Catch {
            Do ##class(%REST.Impl).%ReportRESTError(..#HTTP500INTERNALSERVERERROR,ex.AsStatus(),$parameter("MyLearn.LearnREST.Swag.impl","ExposeServerExceptions"))
        }
    }
    Quit $$$OK
}

Some useful links 

HTH.

Hi @Pierre LaFay 

Define a Method instead of  ClassMethod and Instantiate the object for that class and call the required method. It will work

Class Bna.Utils.Sql Extends %RegisteredObject
{

ClassMethod RemoveIrisTestUsers() As %Status
{
    set obj = ..%New()
    New $NameSpace
    Set $NameSpace="%SYS"
    // Get test users by login begining
    Set query = "select * from Security.Users "_
                "where "_
                    "ID like LOWER('ARS%') or"_
                    "ID like LOWER('CHERCHEUR%') or"_
                    "ID like LOWER('CS%') or"_
                    "ID like LOWER('DGOS%') or"_
                    "ID like LOWER('CENTRE%')"
    Set sc =obj.SelectFirstColsInArray(query, .userIds)
    if 'sc Return sc
    zw userIds

    Return $$$OK
}

Method SelectFirstColsInArray(query, test)
{
    zwrite query,test
    return $$$OK
}

}

Hello @Andy Stobirski 

Have you created a web application? If not, You have to create a web application. Configure the necessary details such as namespace, url add your PCRest.disp in dispatch class and assign roles. Save the application and call your RESTFul api from postman.

/// Says Hello
ClassMethod Hello() As %Stream.Object
{
	return {"status":"ok","message":"working"}
}