#REST API

10 Followers · 627 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 Anastasia Dyubaylo · Apr 6, 2020

Hi Developers!

Want to participate again in the competition of creating open-source solutions using InterSystems IRIS Data Platform? 

Then we're pleased to announce the second InterSystems IRIS Online Programming Contest!

And the topic for this contest is InterSystems IRIS with REST API.

The contest will again last three weeks: April 13-May 3, 2020

Also, please join the InterSystems Contests Discord Channel to chat about contest and technology.

 

37
2 2235
Announcement Evgeny Shvarov · Apr 13, 2020

Hi Developers!

Today we launched the second programming contest on InterSystems IRIS, the landing.

The topic is the REST API.

And we introduced a few technology bonuses.

Here I want to provide details on what application eligible, what are the technology bonuses and how to collect all of them.

Here we go!

7
0 581
Announcement Guillaume Rongier · Apr 6, 2020

InterSystems offers an API-design first approach.

You can check this post for more informations : https://community.intersystems.com/post/iris-api-explorer-application.

One practical thing about this approch and the OpenAPI specification is the definition of exchange objects.

The do ^%REST command does not create object definitions, but only routes and associated methods.

Output for the do ^%REST command for PetShop example :

USER>do ^%REST

REST Command Line Interface (CLI) helps you CREATE or DELETE a REST application.
Enter an application name or (L)ist all REST applications (L): PetShop
REST

2
5 1049
Article alex kosinets · Apr 20, 2020 1m read

Download  MX  into folder  C:/mx   (if Windows)

Create the REST application MX in IRIS namespace USER:

  • USER> do ^%REST …………
  • USER> do $System.OBJ.ImportDir(“c:/mx”,”vmx.ro”,”ck”,,1)
  • USER> do $System.OBJ.ImportDir("c:/mx","rest.xml","ck",,1)

Prepare excel sheet - place on it mx-formulas and mumps-commands:

To connect excel correctly, you must first specify the server address and port in MX_CONFI.xlsb sheet 'connections'. Port see in ^|"%SYS"|%SYS("WebServer","Port").

Run MX.XLSB. Commands written on sheet created a test global on the server and the interface buttons. 

To add a new person to

0
0 892
Question Edrian Golob · Jun 4, 2019

Hello Guys,

Can someone help me?

I'm triggering a Rest Services, my JSON is a String variable(Request.JSON), when I pass it on EntityBody.Write, WS returns me the 403 error.
When I pass Obj = {} it responds by saying that no Data has been sent.
So, my problem is to set the "Obj" with the String variable, I should convert it, correct?But how do I do this?My JSON is all in this variable.

MyCode:

        Set Dados = ##class(%Net.HttpRequest).%New(),
            Dados.Authorization = pBearer _ Request.Token,
            Dados.ContentType = "application/json"
 
        $$$TRACE(Dados.Authorization)

5
0 662
Question Jordan Everett · Apr 15, 2020

Hello all,

I'm new to the Intersystems development world and I've been trying to figure out how to make a REST API using ObjectScript. I found a tutorial that I've been following that has been great and I'm trying to translate what I've learned to live data.

My question is "Is there a way I can set a variable inside of a class so when I call a routine that variable will be recognized?" I'm capable of setting the variable in a terminal session and then calling the routine and everything will be work great!

2
0 372
Article David Reche · Apr 5, 2020 1m read

I have Mac OSX and Docker Desktop 2.2 (Engine 19.03).

I have a REST service running on my localhost (Mac) and I was trying to consume it from IRIS running in a Docker container.

If you try something like that don't use localhost as HTTP Server setting (using a Business Operation for example).

You have to use host.docker.internal.

2
0 305
Article Jose-Tomas Salvador · Apr 25, 2018 2m read

What if you could serialize/deserialize objects in whatever format: JSON, XML, CSV,...; attending different criteria: export/import some properties and not others, transform values in this or that way before exporting/importing,...; and all of this without having to change the class definition? Wouldn't that be great??

Well, perhaps it's a goal too ambitious to reach 100% but, exploring this idea, I've developed a bunch of classes that I thought it was good to share. If you want to test, change, modify or improve the code, or just take a look at it, you can do it here. There you'll find a more detailed explanation (see Readme.md)

Be aware, this is a proof of concept for myself done in spare times, sure it's not robust enough or it can be done much better... but, I was just playing...ok, I could just wait to the new JSON Adaptor (coming soon!) that sure is going to resolve much more scenarios in a cleaner way, but... meanwhile... :-) ...
4
4 2798
Question Evgeny Shvarov · Dec 26, 2019

Hi Developers!

I stuck with one interesting problem. 

For example, let's use this template repo. If you build this container A using docker-compose and then run the container it exposes REST-API  which is available on:

localhost:52773/person/all

The question is how to make this REST-API accessible from another docker container B running on the same machine? E.g. with IRIS 2019.4 Community from this repo?

The problem is that for the second container localhost it's something which belongs to container B.

I think I need to set up a network between containers somehow. E.g. using docker-compose. But is there any simpler way?

2
0 380
Announcement Amir Samary · Jan 29, 2020

Hi everyone,

I am very pleased to announce that the Readmission Demo has been released as open source. Many thanks to the Solution Factory team that worked hard on making this possible.

Here are the changes:

  • It is now running on top of IRIS Community 2019.3.0.308.0.
  • It has synthetic data based on Synthea instead of the real data we were using before. But the machine learning models are 100% real
  • Image RRLACESrv has been renamed to “image-riskengine”
  • Image “readmissionsrv” has been renamed to “image-risksrv"
  • We refactored a lot of the code on image-riskengine to look better.
0
2 611
Article Eduard Lebedyuk · Mar 14, 2018 10m read

Intro

For many in today's interoperability landscape, REST reigns supreme. With the overabundance of tools and approaches to REST API development, what tools do you choose and what do you need to plan for before writing any code? This article focuses on design patterns and considerations that allow you to build highly robust, adaptive, and consistent REST APIs. Viable approaches to challenges of CORS support and authentication management will be discussed, along with various tips and tricks and best tools for all stages of REST API development. Learn about the open-source REST APIs available for InterSystems IRIS Data Platform and how they tackle the challenge of ever-increasing API complexity. The article is a write-up for a recent webinar on the same topic.

5
6 3106
Question Michael Davidovich · Dec 3, 2019

I am writing an API that sends over a very large JSON object. 

The code I'm using to get the data is actually used in our production system today for the use of writing a report.

However when I call the code using the API (using SoapUI) I am getting 'Error getting response; java.net.SocketTimeoutException: Read timed out'

The web applications settings have a session timeout setting at 15 minutes, but this is timing out within just a few minutes, so I know it's not hitting this mark.

Has anyone experienced this issue with APIs?

3
0 412
Question Jimmy Christian · Nov 23, 2019

Hello community,

I have a very simple REST API connection doing a POST of JSON messages via AZURE APIM. 

It worked successfully for few weeks until a day ago when i started receiving a bad response as below.

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><meta name="format-detection" content="telephone=no"><meta name="viewport" content="initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><script type="text/javascript" src="/_Incapsula_Resource?......................................
 

Is there anything to put in the http header to avoid this message or any suggestion

2
0 455
Article Eduard Lebedyuk · Nov 22, 2019 1m read

This quick guide shows how to serve HTTPS requests with InterSystems API Management. Advantage here is that you have your certs on one separated server and you don't need to configure each backend web-server separately.

Here's how:

1. Buy the domain name.

2. Adjust DNS records from your domain to the IAM IP address.

3. Generate HTTPS certificate and private key. I use Let's Encrypt - it's free.

4. Start IAM if you didn't already.

5. Send this request to IAM:

POST http://host:8001/certificates/
{
    "cert": "-----BEGIN CERTIFICATE-----...",
    "key": "-----BEGIN PRIVATE KEY-----...",
2
1 675
Article Evgeny Shvarov · Nov 19, 2019 1m read

Hi developers!

I just want to share with you the knowledge aka experience which could save you a few hours someday. 

If you are building REST API with IRIS which contains more than 1 level of "/", e.g. '/patients/all'  don't forget to add parameter 'recurse=1' into your deployment script in %Installer, otherwise all the second and higher entries won't work. And all the entries of level=1 will work.

/patients

- will work,  but

/patients/all

- won't.  

Here is an example of CSPApplicatoin section which fix the issue and which you may want to use in your %Installer class:

    <CSPApplication Url="${CSPAPP}"
      Recurse="1"
      Directory="${CSPAPPDIR}"
      Grant="${RESOURCE},%SQL"
      AuthenticationMethods="96"
      />
0
1 314
Announcement Eduard Lebedyuk · Nov 12, 2019

First webinar on  InterSystems API Management!


We are pleased to invite you to the upcoming webinar in Russian: Introduction to InterSystems API Management on November 21 at 10:00 Moscow time (GMT+3)!

As you might have heard, we recently introduced the InterSystems API Manager (IAM) - a new feature of the InterSystems IRIS Data Platform,
enabling you to monitor, control and govern traffic to and from web-based APIs within your IT infrastructure.

In this webinar I will highlight some of the many capabilities IAM allows you to leverage. InterSystems API Manager brings everything you need:

  • to monitor your HTTP-based API traffic and understand who is using your APIs; what are your most popular APIs and which could require a rework.
  • to control who is using your APIs and restrict usage in various ways. From simple access restrictions to throttling API traffic and fine-tuning request payloads, you have fine-grained control and can react quickly.
  • to protect your APIs with central security mechanisms like OAuth2.0 or Key Token Authentication.
  • to onboard third-party developers and provide them with a superb developer experience right from the start by providing a dedicated Developer Portal for their needs.
  • to scale your API demands and deliver low-latency responses

There would be a live demo.

This webinar is for System Architects, Developers and DevOps Engineers.
Time: November 21 at 10:00 Moscow time (GMT+3)!

The language of the webinar is Russian.


Register!

5
0 419
Announcement Anastasia Dyubaylo · Oct 30, 2019

Hi Community,

Please join the upcoming InterSystems Israel Meetup in Herzelia which will be held on November 21st, 2019! 

It will take place in the Spaces Herzliya Oxygen Ltd from 9:00 a.m. to 5:30 p.m.

The event will be focused on the InterSystems IRIS: it will be divided into IRIS for Healthcare and IRIS Data Platform. A joint lunch will be also included.

Please check the draft of the agenda below:

2
0 428
Question Yone Moreno · Nov 12, 2019

Hello good afternoon!

We're testing a REST Operation, to View Devices using OneSignal API

We are sending the request from Production's Operation Test tool, using the following code:

What happens is that it tells us error of SSL Configuration:
 


 

It should be noted that the test was done without https, to:

set path = http://onesignal.com/api/v1/players?app_id=...

If we see the trace of the browser, we get that OneSignal when receiving an HTTP request, redirects it to HTTPS:

Receives HTTP, redirects:

to HTTPS:


With what we have written, we get an empty answer (the 1st redirection) and an SSL error (the

1
0 1021
Question Kurro Lopez · Oct 30, 2019

Hello,

We need to create a versioning of an existing API, so we going to set a default version (so far) for current connections to version 1

My first attempt is:

XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
    <Route Url="(?i)/check" Method="GET" Call="CheckApi"/>
    <Route Url="(?i)/getcustomer" Method="POST" Call="GetCustomerDefault"/>
    <Route Url="(?i)/revoke" Method="DELETE" Call="RevokeDefault"/>
    <Route Url="(?i)/:version/getcustomer" Method="POST" Call="GetCustomer"/>
    <Route Url="(?i)/:version/revoke" Method="DELETE" Call="Revoke"/>
5
0 549
Question Larry Pinsky · Oct 21, 2019

I have a text file that I pick up in a Business Service and need to send it to our vendor via JSON.  I assumed (probably wrongly) that I could just create a RESTful Business Operation, plug in the server IP and URL as well as complete some of the other fields on the BO to send the file.  When I do this, I get the following error:

ERROR <Ens>ErrException: <PROPERTY DOES NOT EXIST>zOnMessage+5^EnsLib.HTTP.GenericOperation.1 *HTTPHeaders,Ens.StreamContainer -- logged as '-' number - @' Set tHeaderKey="" For { Set tHeaderKey=pRequest.HTTPHeaders.Next(tHeaderKey) Quit:""=tHeaderKey Set

4
0 935