George Hodder · Jul 17, 2017
Connecting to a web service


I am new to coding web services and trying to connect to an API that returns its format in xml or json.

I have a class as follows.. when I run I get back a 6059 in my status - Unable to open TCP/IP socket to server

Can someone help me identify what I am missing?  Thanks

0 12 1,919
Chris Paraskiv · Mar 20, 2017
AWS API calls

This question is about calling AWS REST APIs. Based on:

AWS requires REST clients to call their APIs using Signature Version 4 which in case you don't know what I am talking about is a pain in the neck.  Here comes the question:

Has anybody, by any chance implemented the v4 signing alg. in COS? If yes, would she or he have the kind heart to share?





0 11 742
Eduard Lebedyuk · Oct 12, 2019
How do you search with REST

The question is pretty much in title. I'm developing a REST API, it has a search endpoint with 10 optional parameters. How do I pass them and stay RESTFul?

To ease the question a bit let's agree that:

  • all parameters are AND parameters, user can't make combos, ORs, etc. User can only provide values
  • all values are integers so I don't have to think about URL limits
  • all values are atomic
  • all conditions are about equivalency

Some options I know of:

1. URL parameters.

0 9 789



I have a DB server (ser-app-db) where cache is installed as server.

I have a Web server (ser-app-w) where cache is installed as web server and configured as CSP gateway.

I followed the configuration guide ( and ser-app-w perfectly display the CSP and CLS pages.


But that's not working for my REST service, for exemple with the REST sample:

0 9 973


I'm getting mad trying to get data from an external REST service that uses Basic Authentication from Ensemble. The BO worked fine when I was using a test server without authentification, but as soon as we need to go to production I cannot have it working.

So far, I've created the username/password at the credentials page (Ensemble-Configure-Credentials). I've setup the BO to use this credentials. But nothing happens.

I've tried with the Rest Client (addon for Mozilla), and using the same address, port and user/pwd works just fine.

0 8 1,060

Hello Everyone,

We are currently in process of implementing REST APIs using IRIS and we are also looking at using Intersystems API Manager. 

Our aim is to implement a Microservices Architechture where Services are small in size,  bounded by contexts, autonomously developed, and independently deployable. 

We are following a spec first approach where we are first defining the API specs into Swagger Hub and using IRIS API Management Service to build the REST classes i.e. the Specification class, Dispatch class and Implementation Class.

0 8 275
Roberto Cahanap · Sep 14, 2018
REST POST 405 error

I'm testing out the new %CSP.REST way of creating an api and having a problem with a POST getting a 405 error.

I get data returned when I do a GET, so I don't think it's a configuration issue or a class issue.

I have no problem with %CSP.Page when creating a REST type method. So what am I missing?

Can someone give me some advice?

Thank you.

0 8 309
Bob Felbol · Apr 20, 2018
Special Character API


Made a request for API REST.

Using HTTP Request adapter.

Adapter As EnsLib.HTTP.OutboundAdapter

Outside the Ensemble an API response is JSON (CORRECT)

Answer in Ensemble: =?Á

ÔºQZéýNÕ V{C?óò?b¢?éÍ )$ 
²5Å?wEë? ??©tÖã1z×2FëÊnôeË æ??]Zßq ܺ?á

Help me.

Thank you

0 8 330

I need to redirect user to a url, which is 5000+ characters long.
To do that I set:

set %response.Redirect = url

However, in the browser I receive this header:

LOCATION: <First 3972 characters of the 'url' variable>

In WriteHTTPHeader method of %CSP.Response, where the LOCATION header is

Write "Location: ", <Redirect>,!

After I added a buffer flush, after the above-mentioned line:

0 8 295


I want to convert a json, which passed on in the a REST call, into a request message. 

I use method %ConvertJSONToObject of the %ZEN.Auxiliary.altJSONProvider class.

Set sc = ##class(%ZEN.Auxiliary.altJSONProvider).%ConvertJSONToObject(%request.Content, "TestRequest", .request)

Is there an alternative for this? I want to avoid to use the %ZEN library.

Best Regards

Roger de Coninck

0 8 492
Pasi Leino · Apr 11, 2017
Authentication with REST

We are building a bunch of rest based services using Ens 2016.2 to serve our browser based application (Angular 4).

Two questions:

1. The initial authentication seems only work if credentials are placed in the url parameters.  Trying to use the Authorization header instead, the client code immediately complains about Access-Control-Allow-Origin. How can I resolve this?


2. After initial authentication, what is the proper way to send subsequent rest calls without having to include credential every time?

0 7 2,047

I am trying to write an application that will take some information on the database make a call to the Google API distance matrix and get the information to use with rest of the application without using the ensemble part of the development is this possible and how can I do my communication with the  API from a cache class thanks in  advance

0 7 1,010
Javier Gonzalez · Jun 1, 2017
Casting JSON

I'm doing a REST service. A method has as body parameter a JSON corresponding to a class A.

In my production I have class A so that I retrieve the parameters using a dynamic object, such that:

Set body = ##class(%DynamicObject).%FromJSON(%request.Content)
Set myObjectA = ##class(A).%New()
Set myObjectA.Id = body.Id
Set myObjectA.Name = body.Name
Set myObjectA.Date = body.Date
Set myObjectA.Salary = body.Salary

I would like to know if I can avoid doing the manual mapping, doing a casting, since I am sure that FromJSON will return a class A. Something like this:

1 7 688

Hello, our customer, large industrial company, is considering modernizing their old CSP application so it can run on multiple client device types, using responsive design.

They have a lot of experience with CSP and some ZEN.

They are new to REST and have some limited knowledge of javascript - perhaps not enough to the extent used by client framework.

Does anyone have a framework or a set of templates that you would be willing to share?

Thank you!

Dan Kutac 

0 7 625
Chris Stewart · Jun 9, 2016
REST Services Cataloging

I've been building up a REST services API, consisting of a dozen or so classes referenced from a Dispatch class, which has route mappings for the first piece of the URI.  I'd like to have the Dispatch class be able to output all of the available Services, with some documentation.  Is there something like a %Library resource that I could use to pull this information from each of the classes?



0 7 699
George James · Oct 20, 2016
RSS Feed problems


Thank you for your help yesterday at the Belfry.

When I try to subscribe to the RSS feeds using some news readers they do not accept them.

The W3C validator makes a lot of suggestions about what might be wrong, but my guess is that the feed title is blank.  Could this be fixed please?

W3C feed validator results for a group:


0 6 202

Hi.. I have an issue where we are using OAuth2.0 with the ZAUTHENTICATE routine.  Once our token is validated we are using a users lan id (passed on the ID token) to find a software defined username in a Cache Global.

That is all working fine in ZAUTHENTICATE.. I am setting the software defined username in the Properties("Comment") array and wanting to reference it in the Rest Service Dispatch class.

0 6 623


I tried to access one server to another server in Cache Rest Service, I tried 

Parameter HandleCorsRequest = 1;


<Route Url="/data/:first/:second" Method="GET" Call="GetData" Cors="true"/>

But not working,

Can anyone tell me the solution??

Thanks in advance!!

1 5 1,139

We are using an F5 load balancer to route public traffic to our IS server. My goal is to block public access to the Management Portal, and only allow what we want to expose, such as REST/SOAP services. At the F5, they can block URL wildcards or specific ports, so those are our options.

Since the URLs for the web services are in the same path ([host]/csp/healthshare/[namespace]/*), I can't see any URL wildcards happening. That leads me to ports; is there a way to put services on a specific port for all services, and everything else stay on a standard web port?

0 5 258