Web Development

Syndicate content 22 

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.

Last comment 26 November 2018
+ 3   3 2
474

views

+ 3

rating

Hi All,

Actually, I'm developing few restful API's. I want to create a authentication tokens and display it on my login restful API. If I'm using CSP sessionId, how can I validate the session Id's in another or continues restful API's. else, is there any other approach to handle this task. 

My Primary goal is, I have to integrate 2 different front end applications. One is Zen framework another one is web pages from Python. 

If any lead, it would be appreciated. 

Thanks,

Arun Kumar Durairaj. 

0   0 1
0

answers

0

comments

121

views

0

rating

This code snippet provides a ZEN page that downloads a stream from its database directly:


/// We assume that you have stored your data within this schema:
/// MyApp.Model.Storage: Filename,FileSize,Content,ContentType
Class zen.downloadStream Extends (%ZEN.Component.page,%CSP.StreamServer)
{
 
    /// Wrapper to get the id of the download, we assume that the id is passed to this zen page
    /// as a URI parameter, i.e.: MyApp.Downloads.cls?OID=1234
    ClassMethod GetId()
    {
        Quit $Get(%request.Data("OID",1))
    }
     
    /// Set the appropriate header for the file.
    ClassMethod OnPreHTTP() As %Boolean
    {
        Set tId = ..GetId()
     
        If ##Class(MyApp.Model.Storage).%ExistsId(tId) {
            Set tStream = ##Class(MyApp.Model.Storage).%OpenId(tId)
            // You could "guess" the content type by its file extension
            // or you can store it (before) in the database separately (like in this example).
            // Set Extension = $Piece(tStream.Filename,".",$Length(tStream.Filename,"."))
            // Set ContentType = ..FileClassify(Extension)
     
            Set %response.ContentType = tStream.ContentType
            Do %response.SetHeader("content-disposition","attachment; filename="_tStream.Filename)
            Do %response.SetHeader("Content-Length",tStream.FileSize)
        }
        Else {
            Set %response.Status="404 File Not Found"
            Quit 0
        }
        Quit $$$OK
    }
     
    ClassMethod OnPage() As %Status
    {
        Set Download = ##Class(MyApp.Model.Storage).%OpenId(..GetId())
        Do Download.Content.OutputToDevice()
        Quit $$$OK
    }
 
}

Link to code on GitHub

Last comment 9 October 2018
+ 1   2 2
135

views

+ 1

rating

or "Bonus Breakage"

In our last lesson, we added a relationship between 2 persistent classes.  We are clearly going to need to start creating REST Services to expose CRUD operations for each of these classes, but before we do that, we should really finish defining our linkages.  We added code to our Widget toJSON to spool off related Accessory data, so we should really do the reciprocal and allow Accessories to return all Widgets that are compatible.

Last comment 24 September 2018
+ 3   1 2
491

views

+ 3

rating

404 Not Found

{
"error": {
 "errors": [
  {
   "domain": "global",
   "reason": "notFound",
   "message": "Not Found"
  }
 ],
 "code": 404,
 "message": "Not Found"
 }
}

I want to do something like the above sample from a Google Storage JSON API. I have a call to Write obj.%ToJSON() followed by return ..ReportHttpStatusCode(..#HTTP404NOTFOUND) however the HTTP Status code is always 200.  If I remove the Write obj.%ToJSON() statement it returns a 404 status with no body. How do I return both?

Last answer 19 September 2018
0   0 3
0

comments

266

views

0

rating

Hi All,

I'm practicing Atelier in Eclipse, but

While working CSP page.

      1. Create new Web Application 

      2.  Open CSP Web Application in Atelier Project 

      3. New CSP page -> Save

i'm getting below error Message.  

/testv1/test.csp was saved locally but could not be saved remotely.

ERROR #5912: Page '/testv1/test.csp' does not exist

test.csp is saved locally but could not be saved remotely.

Last answer 14 September 2018 Last comment 15 September 2018
0   0 3
135

views

0

rating

I am using &html<> to output some CSS to my page (which is a class-based and not a tag-based page), and the selectors contain the '>' character which the compiler chokes on.  How can I escape the '>' so it still displays as such in the web page source but doesn't trip up the compiler?

This is for 2012.2 btw.

Last answer 20 November 2015 Last comment 20 November 2015
0   0 2
265

views

0

rating

I faced with the issue when WebSocket connection just fails without any errors if I send data with size 384 bytes and more (In binary mode the same). As I know by standard WebSockets frame does not have such limitation. Is there any way how to decrease it? This limitation too small, it is too difficult to fit this size and needs to send data much more often than I expected. Tested with Caché 2016.2, 2017.2 and IRIS 2018.1.

Last answer 6 September 2018 Last comment 5 September 2018
+ 1   0 2
228

views

+ 1

rating

Hi everyone,

 

are you curious which topics we are going to cover at this year’s Global Summit? You have come to the right place! I will provide you with a sneak peek of what you can expect from the areas I am responsible for.

Last comment 5 September 2018
+ 5   1 3
667

views

+ 5

rating

Does anyone have any experience with getting, unfortunately, an older version of Cache to authenticate via SMTP to send email? I have verified that the settings are set up properly on the mailbox as I have successfully sent an email from a LAMP server, which comes from the same IP address.

If you have any thoughts, I would greatly appreciate it.

 

This is the error I receive

ERROR #6034: SMTP server connection failed during MAIL FROM command: <READ>zSend+105^%Net.SMTP.1.

Last answer 26 August 2018 Last comment 25 August 2018
0   0 4
1054

views

0

rating

Good afternoon everyone,

I hope you are well,

I am currently working on the below opportunity and if anyone here would like to hear more details please feel free to contact me on 01908 886 030 or teo.rusu@identifiglobal.com

Met with the client yesterday, beautiful office in Waterloo London, latest tech available with many benefits including working from home 2 days/w as well!

Intersystems Caché Senior Software Engineer

London

+ 3   1 2
0

comments

226

views

+ 3

rating

or "Didn't you say you would cover Persistent Objects in Part 5, Chris?"

Yes, that was the plan.  This is a pretty important topic, so it get's its own Article

Up until now, we've display widget JSON that has been created by a basic loop.  Clearly this isn't of much value.  Now we have our stack connected together, and we can see that the data is flowing to the Welcome page, it's time to complete the stack and start feeding our service from "real" data.

Last comment 4 July 2018
+ 2   0 3
764

views

+ 2

rating

I cannot connect to Cache from node.js  

I have installed in Windows 10 the following: CACHE 2016, node.js v 4.4.7 and  express .

-  where can I get cache.node? The link in the Intersystmes documentation  http://globalsdb.org/downloads/  doesn't work. I found cache0100.node and cache0120.node  in my Cache instance's  \bin directory. But I am not sure if I can use them or not.

 - how to install cache.node ? Where do I place it exactly? 

Can anyone recommend any tutorial or code example with installation instructions?

Last answer 10 September 2016 Last comment 4 July 2018
+ 1   1 8
2066

views

+ 1

rating

I have inherited a web-based database application and I'm having a hard time understanding the sequence of events when CSP pages are opened.  I have very limited web development experience.

Can anyone recommend a good resource for explaining this?  I have already gone through the Cache Cinema tutorial and the Cache CSP documentation.

Last answer 29 June 2018 Last comment 2 July 2018
0   0 2
131

views

0

rating

In this article I would like to present the RESTForms project - generic REST API backend for modern web applications.

The idea behind the project is simple -after I wrote several REST APIs I realized that generally, REST API consists of two parts:

  • Work with persistent classes
  • Custom business logic

And, while you'll have to write your own custom business logic, RESTForms provides all things related to working with persistent classes right out of the box.
Use cases

  • You already have a data model in Caché and you want to expose some (or all) of the information in a form of REST API
  • You are developing a new Caché application and you want to provide a REST API
Last comment 17 May 2018
+ 12   3 8
3161

views

+ 12

rating

Does developing a RESTful API in Caché remove the requirement to use the InterSystems.Data.CacheClient.dll and generate proxy classes using the Caché Object Binding Wizard for .NET web development? If anyone has links to sample applications using .NET with Caché and REST Services, I would be grateful if you could share them.

Last answer 19 April 2018 Last comment 20 April 2018
0   0 2
235

views

0

rating

Hi.

The message is received a few times a day.

On documentation, this ^ISCSOAP^is log to service SOAP, but why send to cconsole.log?

04/04/18-01:00:00:597 (10608) 2 ^ISCSOAP in Namespace %SYS has been active for 348 day(s).
04/04/18-01:00:00:598 (10608) 2 ^ISCSOAP in Namespace X has been active for 165 day(s).

Help-me.

Tks

Last answer 5 April 2018 Last comment 5 April 2018
0   0 5
280

views

0

rating

This series of articles aims to address the following topics:

  • Creation of a web application based on REST pages;
  • Overview of some tools for tracing (debugging) HTTP requests;
  • Switching from hyperevents to... hyperevents;
  • Integration with jQuery File Upload;
  • Conversion of JSON from the {id:1,parentId:1} format to the {id:1,children:[{}]} format for tree visualization;
  • Integration with jQuery EasyUI (using datagrid and tree as examples);
  • Other topics.

Last comment 8 March 2018
+ 4   0 3
537

views

+ 4

rating

Hi guys,

I am using the %Net.HttpRequest method to get data from a server.

The server will continuously send data. Is there any way that i can able to read the HttpResponse data line by line so that if at a particular line i may terminate the request.

Please advice.

Thanks,

Arya

Last answer 2 March 2018
0   0 2
0

comments

385

views

0

rating

Set httprequest=##class(%Net.HttpRequest).%New()
	Set httprequest.Server="www.intersystems.com"
	Do httprequest.Get("/")
	Do httprequest.HttpResponse.OutputToDevice()
	Do httprequest.Get("/cache/")
	Do httprequest.HttpResponse.OutputToDevice()

The above is the code which i found in this link http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?P... 

Last answer 25 October 2017 Last comment 2 March 2018
0   0 2
1221

views

0

rating