Genii Weblog
Could working with rich text really be RESTful?
Thu 7 Feb 2019, 02:51 PM
Tweetby Ben Langhinrichs
I thought it might be fun to see how the Midas LSX programming model might work as a REST API interface. No particular customer request, but definitely consistent with some of HCL's vision for Domino 11 and even low code development.. Here are a few results of my playing. I want to be clear, this isn't in a released product, and may not be. If anything, it is a demonstration about how flexible Midas programming can be. This required very little work other than adding a JSON parser and making Midas C++ API calls.
Results of GET with /testit.nsf/api/genii/8108D92AE62C4C9485257BCF006F2FEC/Body/Table.1/Row.2
What that initial rich text field looks like
JSON to use in PATCH with /testit.nsf/api/genii/8108D92AE62C4C9485257BCF006F2FEC/Body/Table.1/Row.2
Results of subsequent GET with /testit.nsf/api/genii/8108D92AE62C4C9485257BCF006F2FEC/Body/Table.1/Row.2
Modified rich text field after this patch
Doing the same basic logic in LotusScript (for comparison for those who know Midas LSX)
' *** Code below is untested
Call rtitem.Connect("", "testit.nsf", "8108D92AE62C4C9485257BCF006F2FEC", "Body")
Set rttable = rtitem.DefineChunk("Table 1; Row 2)
' *** Get column one data
Set rtcell = rttable.DefineSubChunk("Inside Column 1)
col1text = rtcell.UnformattedText
col1html = rtcell.GenerateHTML(...)
' *** Get column two data
Call rtcell.GetNextTarget()
col2text = rtcell.UnformattedText
col2html = rtcell.GenerateHTML(...)
' *** Get column three data
Call rtcell.GetNextTarget()
col3text = rtcell.UnformattedText
col3html = rtcell.GenerateHTML(...)
' *** Change column one data
Set rtcell = rttable.DefineSubChunk("Inside Column 1)
Call rtcell.ChangeFont("+Italic")
' *** No change to column two data
Call rtcell.GetNextTarget()
' *** Change column Three data
Call rtcell.GetNextTarget()
Call rtcell.Text = "A terrific debut"
rtitem.Save
Copyright © 2019 Genii Software Ltd.
What has been said: