Tue 18 Aug 2020, 02:28 PMTweet
by Ben Langhinrichs
Last week in my post, Quick primer on JSON-RPC, I promised to post videos showing some features of our new Exciton Boost, due out this month. My tendency is to focus on the whiz-bang, but with APIs, some of the most important things are those that appear simple. With that in mind, my first video is on the REST API that is included with Exciton Boost. The REST API features a lot of power packed in a simple package. As you might expect from our products, high fidelity rendering and round-trip abilities stand out, but so do smaller, less showy aspects.
Since most of this happens under the covers, keep these in mind while you watch the video:
- JSON parser allows single document (object) processing and discarding to minimize memory overhead. Not an issue with 25 small documents, but a huge issue with a thousand documents using extensive rich content.
- Filtered items allow you to retrieve only the items you need from an API that provides too much.
- Renamed items allow you to map item names in the JSON object to different Notes item names.
And remember, it's always Beer O'Clock somewhere...
Code I used in the demo
Dim s As New NotesSession
Dim http As NotesHTTPRequest
Dim json_val As String
Dim ret As String
' *** Retrieve the Beer data from public REST API
Set http = s.CreateHTTPRequest()
http.PreferStrings = True
json_val = CStr(http.get("https://api.punkapi.com/v2/beers"))
' *** Post the Beer data to Domino db
Call http.Setheaderfield("Authorization", AUTHSTRING)
Call http.Setheaderfield("X-Items-List", "Name,Id,Description,food_pairing=Pairing,brewers_tips=Tips,tagline")
ret = http.post("http://localhost/BeerOClock.nsf/api/boost/documents", json_val)
Copyright © 2020 Genii Software Ltd.
What has been said: