Hello everyone!
I have REST API and want check user with http header authorization,
When user input incorrect data refuse them with 401 unauthorized,
Question how to response with 401 unauthorized
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.
Hello everyone!
I have REST API and want check user with http header authorization,
When user input incorrect data refuse them with 401 unauthorized,
Question how to response with 401 unauthorized
Some time ago I got a WRC case transferred where a customer asks for the availability of a raw DEFLATE compression/decompression function built-in Caché.
When we talk about DEFLATE we need to talk about Zlib as well, since Zlib is the de-facto standard free compression/decompression library developed in the mid-90s.
Zlib works on particular DEFLATE compression/decompression algorithm and the idea of encapsulation within a wrapper (gzip, zlib, etc.).
https://en.wikipedia.org/wiki/Zlib
I've got a REST service that I can access via a browser. I can get it to take HTML tags as data and display it back to me (so I know the REST part is working). So if I send it this:
http://MyServer:57772/TestArea/rest/TestQuery?UUID=1&RTX=RTX123456&CareType=Palliative
Then I can pick out the data and tell it to display in the browser, which is great but what I really want to do is put the data into a string and send to a business process that will do lots of looking up but eventually return a URL that my REST service will then redirect the browser to.
In this article, we will explore the development of an IRIS client for consuming RESTful API services that have been developed to the OData API standard.
We will be exploring a number of built-in IRIS libraries for making HTTP requests, reading and writing to JSON payloads, and seeing how we can use them in combination to build a generic client adaptor for OData. We will also explore the new JSON adapter for deserializing JSON into persistent objects.
Working with RESTful APIs
REST is a set of engineering principles that were forged from the work on standardizing the world wide web.
Hello All,
I am compiling a REST Operation to call our hospital Administration system, following tutorials around the REST API's etc. First time we have integrated like this so not much knowledge around our hospital - hoping someone on here can help.
I have been using the JSONStreamToObject Method which is working as i expected, apart from trying to get a specific item in the example JSON Response as follows:
{"test":"abc","name":[{"use":"usual","family":"Matest","given":["Mia"]}]}
I'm able to get family using set pResponse.familyname = tProxy.name.GetAt(1).
I am trying to create REST API following these instructions: https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=GREST_apimgmnt
However it does not work.
I tried downloaded the v2.0 schema.json of the OpenAPI specification and pasted it on Postman with the parameters as speicifed, but I get this error message back:
{
"msg": "ERROR #8738: Correct OpenAPI 2.0 version was not specified: . <$.swagger>\r\n > ERROR #5490: Error running generator for method '%OnCompile:TasksRestApp.spec' \r\nERROR: %REST.Spec.cls(%OnCompile) of generated code compiling subclass 'TasksRestApp.spec'\r\n > ERROR #5030: An error occurred while compiling class 'TasksRestApp.spec'"
}Suppose I have a web application named "/my/api", with a dispatch class configured (a subclass of %CSP.REST), and I want to be able to respond to:
GET /my/api/something/:id
by loading an object with the specified ID and returning it as JSON
GET /my/api/another-thing/data.js
by returning the contents of a file (data.js) in a configured location in the filesystem, ideally based on the "CSP files phsyical path" for /my/api.
Hi community,
This article to give a description of my small library JSON Filter.
Why JSON Filter?
Search, sort data are common operations.
But … How to do this with JSON data?
You can use a %DocDB, It’s a good way for storing JSON and index the main properties.
However, JSON document is very flexible. It isn’t always possible (and not recommended) to index each properties to process the wished queries. A manual processing on a data subset is may be required.
In my opinion, this is not a funny part of the job. It’s a repetitive code with many loops etc.
Hi Developers!
As you know in the second contest we introduced technology bonuses. Learn more.
You can see what app got what bonuses in the Technology Bonuses menu:
And here I want to share with you which apps got the bonus. Here we go!
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.
I enjoy the challenge of being in a contest. Currently I participate in InterSystems IRIS with REST API Programming Contest. My idea for this contest was to create an app to help me keep track of tasks for my Status Reports. I started with the template provided by Evgeny Shvarov. I created a persistent class for Tasks and a REST Dispatch class. I defined my URL map and I even figured out how to test my REST app using Postman. I felt proud of myself for a little while.
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!

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 :
REST Command Line Interface (CLI) helps you CREATE or DELETE a REST application.
Hi Developers,
Please welcome another "Coding Talk" video specially recorded for the second IRIS Programming Contest:
⏯ How to Build, Test and Publish ZPM Package with REST Application for InterSystems IRIS
Download MX into folder C:/mx (if Windows)
Create the REST application MX in IRIS namespace USER:
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.
Hi Community,
New "Coding Talk" video was specially recorded by @Evgeny Shvarov for the second IRIS Programming Contest:
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.
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! I will get the data I want returned.
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.
Hi Community!
Enjoy watching the new video on InterSystems Developers YouTube:
⏯ InterSystems IRIS and Node.js Overview
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)
Hi all!
I'd like to share the code we used in a hands-on session in the last InterSystems Iberia Summit (Spain) about developing a simple Angular app using InterSystems IRIS as backend.
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?
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:
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.
I generated a REST API from a Swagger document with basic security.
When I send a request to that API, I now get an authentication error 401 always.
I entered a user api and a password and gave it the role %All.
I tried to call the API with the URL
http://solidara.net:52773/csp/solidara/get_components/solidara?username…;
What's am I doing wrong there?
This is a basic JavaScript Vue.js example how you can use REST calls using plain HTML.
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?
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.
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-----...",
"snis": [
"host"
]
}