A couple of days ago I wrote the blog-post Teach the old dog some new tricks: Let LotusScript consume REST Services the easy way. I thank you all for the good feedback! Nice to see that some old school, classic Notes development, still got some traction
Well, I was in the spirit to add some features today too!
First and foremost you now have the ability to add a payload to the PostJson, PostXML and PostHTML. By payload I mean a text string of any kind, but typically a JSON or XML. In a way you can think of it as a way of uploading a file or text together with other request headers or URL parameters.
This means that code like this;
… results in this;
Note that the payload isn't tagged a a proper multipart MIME or anything, but perhaps you can add that yourself with a combination of the new support methods for base64 encoding and decoding? You now have these additional methods;
- EncodeStringAsBase64. Encode a string as base64. Build your own multipart XML or MIME structure, and combine that with one or more AddRequestHeaders? Or stuff the base64-encoded string as a payload directly with SetPayload.
- EncodeFileAsBase64. Encode a whole file as base64. Remember that this hasn't been tested on huge files or anything
- DecodeBase64String. Decode a base64-encoded string back to it's textual form.
- DecodeBase64StringToFile. Finally decode a base64-encoded string directly into a file on your disk.
I also added DownloadFileFromURL which can download any file from the specified URL and store it on disk as a file.
The demo-agents in the downloadable sample-database has been updated to use SetPayload, and the other methods are now demoed in a third agent with the name "Test Support Methods".