#REST API

0 Followers · 604 Posts

Representational state transfer (REST) is a software architectural style that defines a set of constraints to be used for creating Web services. Web services that conform to the REST architectural style, called RESTful Web services (RWS), provide interoperability between computer systems on the Internet. RESTful Web services allow the requesting systems to access and manipulate textual representations of Web resources by using a uniform and predefined set of stateless operations. Other kinds of Web services, such as SOAP Web services, expose their own arbitrary sets of operations.

Learn More.

Announcement Rob Tweed · Apr 5, 2024

Hot on the heels of our announcement last week about our ultra-high-performance mg-dbx-napi JavaScript interface for IRIS, we are now pleased to announce a significant new technology - mg_web - which not only represents a new paradigm for JavaScript Web Frameworks, but also delivers significantly higher performance than even the fastest of the established Node.js Web Frameworks, whilst leveraging all the benefits of the big-three industry-standard Web Servers.

0
0 273
Article Pravin Barton · Sep 1, 2022 4m read

Say I've been developing a web application that uses IRIS as the back end. I've been working on it with unauthenticated access. It's getting to the point where I would like to deploy it to users, but first I need to add authentication. Rather than using the default IRIS password authentication, I'd like users to sign in with my organization's Single Sign On, or some other popular identity provider like Google or GitHub. I've read that OpenID Connect is a common authentication standard, and it's supported by IRIS. What is the simplest way to get up and running?

Example 1: a plain CSP app

1
3 1146
Question Daniel Bertozzi · Mar 27, 2024

Hello

I am trying to convert some old rest classes using the OpenApi spec (e.g. %REST.Impl)

Say I want to return a 401 in my impl.cls for api and I can define the status code as follows, e.g.

 Do ..%SetStatusCode("401")
 Do ..%SetContentType("application/json")

However the api client will see this as 401 OK which is not right.

In the past, I could just create a rest class that extends from %CSP.REST and return as follows:

Set%response.Status = ..#HTTP401UNAUTHORIZED

This will return 401 Unauthorized, which what I expect to see reported in the api client.

0
0 202
Question Sylvie Greverend · Mar 29, 2024

I built my rest api with ^%REST and update with CreateApplication.
Postman works fine and I suppose production server will work fine as UI and rest api will be on the same domain, but for now in dev, I need to have access from my local to the Iris rest api. I have a CORS error.

I do not know how to configure my swagger file to have either Parameter HandleCorsRequest=1 or <route Cors=true in the generated displ,cls.

0
0 287
Announcement Olga Zavrazhnova · Mar 15, 2024

Hi Developers,

Join us at the upcoming Developer Roundtable on March 26th at 11 am ET | 4 pm CET. 📍
We will have 2 topics covered by the invited experts and open discussion as always! 

Talks:

➡ Demo on Documenting and Testing REST Call's by generating documentation and making scenario's for integration tests - presented by @Danny Wijnschenk , Application Developer, Winfo.
Danny is an independent developer based in Belgium, specialized in InterSystems Caché and IRIS. He has customers in both the healthcare and non-healthcare sectors.

0
0 181
Announcement Rob Tweed · Mar 26, 2024

You may have heard about our mg-dbx-napi interface for IRIS which provides insanely fast access from Node.js.  If you've been following recent developments in the server-side JavaScript world, you'll be excited to know that mg-dbx-napi also works with Bun.js, the latter proving to be significantly faster than Node.js for many/most purposes.

Of course, if you're a Node.js user, you'll probably wonder how mg-dbx-napi compares with the Native API for Node.js that is included with IRIS.

With all that in mind, we've created a Github repository: mg-showcase

0
0 256
Question Sylvie Greverend · Mar 14, 2024

I am trying to use postman to start the restapi classes from a json openapi2.0.0 file.

POST: https://myserver.com/api/mgmnt/v2/requestAPI. The body contains the openapi2.0.0. The application api/mgmnt has in security settings: password. JWT is not selected. I set postman authentication to basis authentication and gave username and password. I also set in headers IRISUsername and IRISPassword. I have 401 Unauthorized.

Is the only way to go through is to build an oauth token? or do I miss something?

Thank you very much.

0
0 187
Question Ali Chaib · Mar 13, 2024

Dear,

I'm trying to configure a new interface that reads HL7, transform them into FHIR messages and then send POST or PUT or DELETE depending on HL7 doc type.

1-I added an HL7 TCP service that reads ADTs messages

2a-Send ADTs to a process to transform them into SDA  (using the following command:  do ##class(HS.Gateway.HL7.HL7ToSDA3).GetSDA(request,.con))

2b-Extract the patient MRN and add it to the AdditionalInfo property  (using the following request message class: HS.Message.XMLMessage)

3-Send the SDA message to the built in process: HS.FHIR.DTL.Util.HC.SDA3.FHIR.Process.

0
0 216
Question Emil Odobasic · Mar 5, 2024

Hello everyone!
So, I am supposed to receive a REST-request into my production, and I need to send it, exactly as I received it, to another server.
I am struggling to find any good info on this, and have a hard time coming up with a good approach.
What would be the easiest way to do this?
- I have so far thought about possibly doing it with an EnsLib.REST.GenericService and then sending it with an EnsLib.REST.GenericOperation.
- I have also thought about manually creating a rest-service and somehow using %request and sending it directly if that would be possible.

0
0 280
Question Kurro Lopez · Feb 12, 2024

Hi all,

As you know, it is very complicated to debug a Business Service Rest API because the object is created when the applications receive a request, so we cannot have the JobId that we can use to debug.

https://docs.intersystems.com/iris20211/csp/docbook/DocBook.UI.Page.cls…

So, I'm trying to get the JobId when the class is being created, write a trace in OnInit() method and write the JobId in a log info

Method OnInit() As%Status
{
	$$$LOGINFO("JobId: "_$JOB)
	hang20breakQuit..OnInit()
}
0
0 215
Announcement Emily Geary · Feb 29, 2024

Hi All,

On February 8, 2024, we asked for input from the IRIS community regarding exam topics for our InterSystems IRIS Developer Professional exam. We will close the window for providing feedback on the exam topics on Friday, March 8, 2024. If you would like to have your say in what topics are covered on the exam, this is your last chance!

How can I access the survey? You can access it here

0
0 133
Question Armin Gayl · Feb 9, 2024

Hello,

I have a problem with a FHIR Interop scenario that the HTTP Header Value content-type between IRIS and client changes in case of an error (HTTP 422). If I set the status in the response to 200 OK as the last step in the service class, the return transmission works.

Within my operation class, the error code is taken from the source system and entered in the HS.FHIRServer.Interop.Response message. 

Within the CSP gateway I am also shown that the content type is 422 application/fhir+xml and is returned.

0
0 317
Announcement Emily Geary · Feb 8, 2024

Hello Everyone,

The Certification Team of InterSystems Learning Services is developing an InterSystems IRIS Developer Professional certification exam, and we are reaching out to our community for feedback that will help us evaluate and establish the contents of this exam.

Note: This exam will replace the current InterSystems IRIS Core Solutions Developer Specialist exam when it is released. Please note from the target role description below that the focus of the new exam will be more on developer best practices and a lot less on the ObjectScript programming language.

0
0 343
Question Emil Odobasic · Dec 20, 2023

Hello everyone!
I am wondering how I can retrieve multipart form-data from a request that is coming into my REST-service.
I am supposed to retrieve a string and a file. The file is being retrieved without issues, but the "testprofile" string is not being retrieved at all.
It just logs a an empty entry. 
The request that is sent to my REST-service has the Content-Type: multipart/form-data
Thanks beforehand for the help! :)

Down below is the code I use right now to retrieve the string and file from Form-data Rest HTTP-request to my service.

5
0 761
Question Emil Odobasic · Jan 8, 2024

Hello everyone!
I am receiving a HTTP multipart/form-data request into my rest service.
How can I read the values for each Key in the form?
The key "Profile" is sent to my service as a String data type.
The code I have below does not seem to work, where I try to read the Key profile in the form.

I appreciate all the help I can get! :)

26
0 760
Article David Hockenbroch · Jan 4, 2024 22m read

So far, we have covered how to use ObjectScript to manage users, roles, resources, and applications. There are a few other classes in this package that work similarly to the ones mentioned above. However, these four classes are the ones everyone will have to use to manage their application security. Suppose you wanted to create your own Security management portal for this package. There would be some specific issues to think about for an API. Since the classes use similar methods, we can create fewer API endpoints using indirection. However, we should consider differences between those methods

2
3 402
Question Sandeep K C · Jan 10, 2024

Hello Guys,

Our cache application uses REST web services and handles single API request perfectly with response (response status and related data). But sometimes user sends multiple requests to the same API simultaneously ( ie, without waiting for the first to respond ), where one request will succeed (not necessarily the first) and the others will fail. 
So, I need to handle the requests one by one after completing and sending the response for first request in the queue then process the next request and so on.

Is there any appropriate way of handling this problem? 

4
0 356
Question Ashok Kumar T · Dec 17, 2023

Hello Community,

Is there any way to avoid generating the built in validation inside the classmethod from the .disp class definition. I've added the resource with path parameter as integer in swagger 2.0 open API.  The class method(in my case getRandom is the class method) inside .disp handles the integer validation by default. Is there a way to avoid/remove by default.

default validations for Integer

0
0 119
Question Emil Odobasic · Dec 14, 2023

Hello everyone!
I have to build a REST service that receives a POST HTTP-request, collect a file from that request in the Form data and then send it in another HTTP Post request through Form Data. However I can't really seem to send the file, and I do not know where it has gone wrong. All I am getting told is that no file is being received from my HTTP Post request. I am reaching the REST Service I am supposed to send the request to, but nothing is being sent.
I would be really thankful if someone could give some insight why nothing is being sent in my request. Thanks beforehand! :)

6
0 809
Question Michael Wood · Dec 7, 2023

I have a message class define. But sometimes the RelatedItems fields is not returned. 

Parameter %JSONIGNOREINVALIDFIELD As BOOLEAN = 1;

Property RequestedTerm As AH.AHLIB.Custom.Symedical.Message.PostRelationResponse.termsRequested;

Property RelatedItems As list Of AH.AHLIB.Custom.Symedical.Message.PostRelationResponse.RelatedItems;
 

Respnse normally will return someting like this,

on ocassion the RelatedItems are not returned

have response context variable defined as the custom message type

How do I check in a BPL if there is no RelatedItems  in the response?
 

2
0 226
Article Luis Angel Pérez Ramos · Dec 5, 2023 3m read

Welcome everybody!

In this short article I would like to present an example of use that surely many of you who work with IRIS as the backend for your web applications have faced on more than one occasion and it is how to send a file to your server from the frontend.

Generally the simplest way I have found to perform this task is to transform the file from the frontend to the Base64 format and make a POST call to our server attaching the Base64 obtained to a JSON message in which I indicate in a parameter the name of the file and in another the encoded data. Something similar to this:

2
0 619
Question Michael Wood · Nov 28, 2023

I getting the response back to my method fine,

but it is not returning to my BPL.

What am I missing to get the response back to the BPL?

// Execute REST Call
set tHttpResponse=##class(%Net.HttpResponse).%New()
set tSC = ..Adapter.SendFormDataArray(.tHttpResponse,"POST",tHttpRequest,"","",tURL)
set tStatusCode = tHttpResponse.StatusCode
$$$TRACE("Status Code: ["_tStatusCode_"]")
do ..logJSON(tHttpResponse.Data.Read(),"Post Relation Response")

8
0 276