Hello Guys,

Can you please guide me to create a RESTful API service in our cache (using intersystems cache kit) with CSP (Cache Server Pages ) object script.

Class REST.NativeDIspatcher Extends %CSP.REST
{

XData UrlMap [XMLNamespace = "http://www.native.rest.com/urlmap" ]
{
<Routes>
   <!--  <Route Url="/:name" Method="GET" Call="displaySystem" Cors="false" /> -->   
     <Route Url="/:ostype" Method="GET" Call="externalFreeze" Cors="false" />  
  </Routes>
 }

ClassMethod externalFreeze(Ostype as %String) as %Status{
        set status = ##Class(Backup.General).ExternalFreeze()
           WRITE "EXTERNAL FREEZE RESPONSE FOUND " _status
           QUIT $$$OK
    }

}

I had written above code snippet but, I need to explore more using %CSP.REST object script language.

Can anyone suggest/ share sample code snippet to create a REST service web application using %CSP.REST object script language

Last answer 24 September 2018
0   0 3
0

comments

317

views

0

rating

Hi, Community!

Have a question for general discussion. 

In ObjectScript we have cls for classes and mac code, which both compile into int code. 

Is there any reason when you use mac instead of cls  for non-persistent classes?

For me the benefits for cls are:

1. Inheritance and other OOP features

2. Auto-documented code 

For mac one visible benefit is easier call in terminal:

do method^Utils(p1,p2)

vs

do ##class(Package.Utils).method(p1,p2)

What is your choice and why?

Last comment 18 July 2018
0   1 15
1408

views

0

rating

I'm sending data via ajax to my REST service, and while retrieving any information sent in the url parameter is easy when they're defined in the route, I can't get anything if I store information in the data parameter. For example:

$.ajax({
               url: "ServerURL",
               data: { "some": "json" } //How do I get this information?

...

I've looked at many common solutions such as here:

https://community.intersystems.com/post/lets-write-angular-1x-app-cach%C3%A9-rest-backend-part-9

However, %request seems empty for the most part. I can get the url of the request and the method type, but Data, Content, Content.Read(), etc. are always empty. I feel like something simple is missing here that I'm not seeing. Any help is appreciated!

Thanks,

David

Last answer 15 February 2018 Last comment 15 February 2018
0   0 3
315

views

0

rating

Hi All,

Does anybody has experience with Angular application and have implemented some solution in order to track and record pageviews?

We are interested in to know how to capture those pageviews information and call a Caché REST Api in order to store those data.

Thanks.

Last answer 7 February 2018 Last comment 9 February 2018
0   0 4
199

views

0

rating

Hi I currently have a requirement to upload microsoft documents from a client's PC to a cache database, at present the idea is to use javascript to open the file and convert it to a binary stream and then for cache csp to upload the binary stream to the database.  Just wondered if anyone else had attempted this or are there better options !

Regards

Gary

 

Last answer 19 January 2018 Last comment 13 March 2018
0   0 5
376

views

0

rating

a.k.a..  "The World of Widgets Returns!" or "Paternity leave damages Instructional Series momentum"

In our last lesson, we combined 2 separate classes to appear as the same property.  We now have the ability to Update our Widget catalog, but what if we want to Create a Widget?  Thankfully, we've already done 90% of what we need, just by implementing Edits

As we mentioned when creating the REST Services for PUT and POST, the only real difference between creating and updating a record is whether we are passing in an existing ID or creating a %New record.  The actual content of the Widget JSON is exactly the same, so this allows us to be a little lazy and reuse the form and controller code we have previously written, with just some minor edits to allow it to work for New Widget

0   0 1
0

comments

334

views

0

rating

Hi,

I'm having the following error visualizing a PDF report.

An invalid XML character (Unicode: 0x3) was found in the value of attribute "Reaction" and element is "Allergies".

 

Aug 18, 2017 10:50:29 AM org.apache.fop.apps.FopFactoryConfigurator configure

INFO: Default page-height set to: 11in

Aug 18, 2017 10:50:29 AM org.apache.fop.apps.FopFactoryConfigurator configure

INFO: Default page-width set to: 8.26in

Aug 18, 2017 10:50:30 AM org.apache.fop.cli.Main startFOP

SEVERE: Exception

org.apache.fop.apps.FOPException: org.xml.sax.SAXParseException; systemId: file:/D:/SOJHSSDTC/mgr/Temp/Vte547p7Yyihkg.xml; lineNumber: 5; columnNumber: 47; An invalid XML character (Unicode: 0x3) was found in the value of attribute "Reaction" and element is "Allergies"

Last answer 15 January 2018 Last comment 23 August 2017
0   0 2
200

views

0

rating