#REST API

10 Followers · 626 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.

Article Sergei Sarkisian · Dec 30, 2016 27m read

This article is translation of one from Habrahabr InterSystems blog (Russian).
The original post can be found here: https://habrahabr.ru/company/intersystems/blog/251611/
 

Everyone familiar with InterSystems Ensemble, an integration and application development platform, knows what the Ensemble Workflow subsystem is and how useful it can be for automating human interaction. For those who don’t know Ensemble (and/or Workflow), I will briefly describe its capabilities (others may skip this part and learn how they can use the Workflow interface in Angular.js).

InterSystems Ensemble

6
1 4713
Article Yuri Marx · Nov 30, 2022 14m read

Intersystems IRIS for Health has excellent support for the FHIR industry standard. The main features are:
1. FHIR Server
2. FHIR Database
3. REST and ObjectScript API for CRUD operations on FHIR resources (patient, questionnaire, vaccines, etc.)

This article demonstrates how to use each of these features, as well as presenting an angular frontend for creating and viewing Quiz-like FHIR resources.

Step 1 - deploying your FHIR Server using InterSystems IRIS for Health

0
1 1200
Article José Pereira · Nov 29, 2022 12m read

In this article, I’d like to present details of which technologies we had been using to develop our application for the IRIS for Health Contest:

  • REST API generation from OpenAPI specification
  • Role Based Access Control (RBAC) to protect API and Web Pages
  • InterSystems FHIR Server

ToC:

Application overview

0
0 355
Article Eduard Lebedyuk · Nov 26, 2018 2m read

In this article, I would show how you can upload and download files from InterSystems products via http.

The questions about working with files over http arise fairly often on community and I'm usually linking to my FileServer project which demonstrates file upload/download but I'd like to talk a bit more on how we can serve and receive files from InterSystems products.

Downloading a file

If you have a file in on a file system and you know the path you can serve it from REST or CSP context by calling this method:

3
5 3088
Question Marcos Costa · Nov 8, 2021

When using the REST API classes for building services on a spec-first approach, the implementation class methods are usually built this format:

ClassMethod <method-name>(body As %DynamicObject) As %Stream.Object

But sometimes it keeps building the endpoint implementation method like this:

ClassMethod <method-name>(body As %Stream.Object) As %DynamicObject

It has been a problem because the rest of my implementation rely on the fact that the "body" object is a DynamicObject.

The REST spec is exactly the same for all endpoints, but this last it built keeps presenting this problem.

4
0 490
Question Thembelani Mlalazi · Sep 16, 2022

I have a REST Service that I want it to receive a json string request I have set up my URLMap as follows the top URL when populated and requested works fine but I would like my request to be a json string and that is not working I am getting a 500 error am I missing something please advice.

XData UrlMap
{
<Routes>
<Route Url="/:emailAddress/:sendUserEmail/:password" Method="POST" Call="ResetPassword"/>        this works fine
<Route Url="/test" Method="POST" Call="test"/>              I would like this to receive a json formatted string for the above
</Routes>
}

5
0 504
Question Kurro Lopez · Sep 19, 2022

Hi community,

I have to do a development that should to connect with a external REST API and it throws different HttpStatus and a body content with the description of the problem.

I'm using the following code:

set tSC = ..Adapter.SendFormDataArray(.tHttpResponse,"POST",tHttpRequest,,,URL)

If the external API responses throws a 400 Status (Bad Request)

the tSC values is an error status and the value of tHttpResponse is empty, so I'm not able to check what is the Status Code and the content.

2
0 449
Article Oliver Wilms · Sep 11, 2022 2m read

I cloned iris-interoperability-template for my app interoperability-test. I wanted to develop an app to test interfaces in Interoperability productions.

I have never run a container in Docker Desktop. I always run containers in AWS. My first problem was that I got an error when I tried to build the image using docker-compose. The error was about BuildKit. I worked around the error by building the image with a docker build command relying on DOCKER_BUILDKIT environment variable:

DOCKER_BUILDKIT=1 docker build --progress=plain --no-cache --tag testint .

1
1 424
Article Oliver Wilms · Sep 11, 2022 1m read

I deployed online demo here:

https://production-monitor.demo.community.intersystems.com/csp/user/EnsPortal.ProductionConfig.zen?PRODUCTION=dc.Demo.Production#

I updated several settings (File paths and URLs) and I switched Dispatch class to dc.rest.GenericService.

I resent the message from File Service. I saw messages received by both Auth and Api services.

Api process does not (yet) return the desired response. More to come ...

0
0 329
Article Sarah Schlegel · Sep 7, 2022 7m read

 Hello Community!

This article gives an overview of the REST JSON webservices developed for TrakCare.

These webservices allow users to access TrakCare data from outside of the software, mainly through external apps.

They are developed in REST with ObjectScript, and they allow data access in four modes:

0
1 621
Article Istvan Hahn · Sep 23, 2016 6m read

This is a detailed guide to develop RESTful services using InterSystems Ensemble. The goal of this guide is to make you understanding the basic concept and building blocks of a RESTful service. The service is going to provide a very basic functionality (a “Hello world!”).

You will learn how to create required components as Ensemble classes, configure the run-time as an Ensemble Production and create a service configuration as a web application.

3
0 2846
Article Yuri Marx · Aug 8, 2022 24m read

In this article you will have access to the curated base of articles from the InterSystems Developer Community of the most relevant topics to learning InterSystems IRIS. Find top published articles ranked by Machine Learning, Embedded Python, JSON, API and REST Applications, Manage and Configure InterSystems Environments, Docker and Cloud, VSCode, SQL, Analytics/BI, Globals, Security, DevOps, Interoperability, Native API. Learn and Enjoy!

Machine Learning

6
7 1159
Article Muhammad Waseem · Jul 26, 2021 2m read

Healthcare interoperability is instrumental in improving patient care, decreasing healthcare provider costs, and providing a more accurate picture to providers. However, with so many different systems, data is formatted in many different ways. There are many standards that have been created to try to solve this problem, including HL7v2, HL7v3, and CDA but each one has its drawbacks.

2
1 2994
Question Michael Davidovich · Jul 29, 2022

What are other's thoughts, opinions and experiences going from CSP to RESTful services, specifically when it comes to reusing code in CSP files?

One could define a method in CSP as follows:

<script language="cache" method="SubmitSomethingAwesome" arguments="aswesomeId:%Numeric"> 

And it's generated in csp.mycsppage.cls ascsp.mycsppage.SubmitSomethingAwesome(awesomeId as %Numeric).

Have people had success defining there rest call by calling the generated CSP classmethod?

Things that work well I've found:

3
0 538
Article Eduard Lebedyuk · Nov 20, 2019 9m read

In this article, I would like to talk about the spec-first approach to REST API development.

While traditional code-first REST API development goes like this:

  • Writing code
  • REST-enabling it
  • Documenting it (as a REST API)

Spec-first follows the same steps but reverse. We start with a spec, also doubling as documentation, generate a boilerplate REST app from that and finally write some business logic.

This is advantageous because:

  • You always have relevant and useful documentation for external or frontend developers who want to use your REST API
  • Specification created in OAS (Swagger) can be imported into a variety of tools allowing editing, client generation, API Management, Unit Testing and automation or simplification of many other tasks
  • Improved API architecture.  In code-first approach, API is developed method by method so a developer can easily lose track of the overall API  architecture, however with the spec-first developer is forced to interact with an API from the position if API consumer which usually helps with designing cleaner API architecture
  • Faster development - as all boilerplate code is automatically generated you won't have to write it, all that's left is developing business logic.
  • Faster feedback loops - consumers can get a view of the API immediately and they can easier offer suggestions simply by modifying the spec

Let's develop our API in a spec-first approach!

6
10 3521
Question Michael Davidovich · Jul 26, 2022

I have successfully created REST service classes on my local IRIS server following this book: Using the /api/mgmnt/ Service | Creating REST Services | InterSystems IRIS Data Platform 2021.2

I am now 1) trying to edit impl.cls in VS Code and 2) export it to my local repo so I can push to the remote repo.

When I click on my project in VS Code and 'Add to project' and choose the new package, spec.cls and impl.cls, I get the following error:

ERROR #5540: SQLCODE: -114 Message: Unable to acquire lock for INSERT of child row for parent table '%Studio.Project' with parent id = 'Default_project'

12
0 444
Article Yuri Marx · Jul 13, 2022 3m read

The Carbon Footprint Counter application uses the GHG Protocol to measure carbon emissions on enterprises. The GHG protocol establishes comprehensive global standardized frameworks to measure and manage greenhouse gas (GHG) emissions from private and public sector operations, value chains and mitigation actions.

Building on a 20-year partnership between World Resources Institute (WRI) and the World Business Council for Sustainable Development (WBCSD), GHG Protocol works with governments, industry associations, NGOs, businesses and other organizations. (source: https://ghgprotocol.org/about-us).

2
0 659
Article Oliver Wilms · Jul 10, 2022 1m read

As I was thinking what I could develop for InterSystems Full Stack Contest, I saw this post:

https://community.intersystems.com/post/how-access-production-items-through-objectscript

I developed ProductionManager.csp. It displays items in the active production. It also displays the Class in use and the date and time of last message. I believe these data points can help you make decisions which items to remove from the production.

0
0 291
Question Oliver Wilms · Jul 10, 2022

I am still working on iris-for-money app: https://github.com/oliverwilms/iris-for-money

Account.csp posts a rest call with _SYSTEM username and the password.

xhttp.open("POST", "/restapi/sql/" + query, true,"_SYSTEM","SYS");
xhttp.send();

/restapi web application has Password Authentication Method enabled.

SYS is the correct password for _SYSTEM user.

I do not understand why I see login failure in Audit database.

1
0 381
Question Oliver Wilms · Jul 9, 2022

I am working on iris-for-money app: https://github.com/oliverwilms/iris-for-money

Account.csp posts a rest call with _SYSTEM username and the password.

xhttp.open("POST", "/restapi/sql/" + query, true,"_SYSTEM","SYS");
xhttp.send();

The error is logged in Riches.REST for this line:

Set tSC = tStatement.%Prepare(pQuery)

3
0 1144
Article Tani Frankel · May 6, 2020 2m read

While reviewing our documentation for our ^pButtons (in IRIS renamed as ^SystemPerformance) performance monitoring utility, a customer told me: "I understand all of this, but I wish it could be simpler… easier to define profiles, manage them etc.".

After this session I thought it would be a nice exercise to try and provide some easier human interface for this.

The first step in this was to wrap a class-based API to the existing pButtons routine.

I was also able to add some more "features" like showing what profiles are currently running, their time remaining to run, previously running processes and more.

The next step was to add on top of this API, a REST API class.

With this artifact (a pButtons REST API) in hand, one can go ahead and build a modern UI on top of that.

For example -

15
4 1349
Question Markus Böckmann · Jun 8, 2022

Hi guys,

has anyone done a simple angular searchbar with a REST API on Caché in the back?

I've done this Let's write an Angular 1.x app with a Caché REST backendhere in the community and it

works fine for me.

The REST in Caché is already developed but im hanging at the searchbar in Angular, don't know how to solve this.

Has somebody an example to help me out?

Any help would be appreciated.

0
1 320
Article Muhammad Waseem · May 30, 2022 3m read

Hi Community,

This post is a introduction of my open exchange iris-fhir-client application.

 iris-fhir-client can connect to any open FHIR Server by using embedded python with the help of fhirpy Library.
Get Resource information by terminal and by using CSP web application.

2
0 1025
Question Utsavi Gajjar · Jul 28, 2021

Hello All,

I am just wondering if there is any inbuilt function or utility available in IRIS to clean up "null" elements from JSON e.g. I want to remove "null" elements from payload below before I do any processing with it.

{

recipients: [ 

{ "name":"Utsavi", "email":"utsavi@gmail.com"},

{ "name":"Utsavi 1", "email":"utsavi1@gmail.com"},

null, null

],

content:[null, {"title":"Test.pdf", "data":"ygwehfbnwfbhew"} ]

}

Thanks & Regards,

Utsavi

10
0 985