[HOWTO] Use Steempunknet API Data in LibreOffice Calc

This is a rough #linux #howto guide showing how I accessed the Steempunk.net API data from LibreOffice Calc. I am using LibeOffice v5.1.6.2 and OpenJDK v8 (1.8.0 rev 181) for this #howto, and I cannot guarantee the same results on any other versions. In fact, I cannot guarantee the same results even if you are running the same versions as I am. Java is a messy thing, and I normally try to avoid it. ๐Ÿ˜„

โถ Check your Java

I will assume that you already have both of the packages above aleady installed. The scope of this #howto doesn't include installing any software, sorry. One thing you should check, however, is that Java is enabled in LibreOffice before we go any further. To do this, go to Tools โ‡จ Options โ‡จ LibreOffice โ‡จ Advanced and make sure that the radio-button beside your installed Java runtime environment is selected, as per the screenshot.

โท Install the extension

Now, I told you a little lie to make you feel at ease about this procedure. Unfortunately, there is a little bit of software to be installed. We need the third-party extension itself which will enable LibreOffice to handle JSON data streams. For this part, I am using the LibreOffice GetRest Plugin by Dmytro Bazunov. You can download the latest version of the *.oxt file (LibreOffice extension filetype) from here (direct link, 2.5MiB). Once you have downloaded the file, you need to install it in LibreOffice. To do this, go to Tools โ‡จ Extension Manager... โ‡จ Add in LibreOffice and locate the *.oxt file which you downloaded. Once it is installed, it should look something like the screenshot here.

โธ Connect to the API

The next step is to connect to the #Steempunknet API endpoint that you are interested in. For this example, we are going to use the new list of SPN Fighters, with their usernames and registration dates (https://www.steempunk.net/api/spn/v1/fighters?details=1). In a new spreadsheet, in cell A1, type...

=๐™ถ๐™ด๐šƒ(๐™ท๐šˆ๐™ฟ๐™ด๐š๐™ป๐™ธ๐™ฝ๐™บ("๐š‘๐š๐š๐š™๐šœ://๐š ๐š ๐š .๐šœ๐š๐šŽ๐šŽ๐š–๐š™๐šž๐š—๐š”.๐š—๐šŽ๐š/๐šŠ๐š™๐š’/๐šœ๐š™๐š—/๐šŸ๐Ÿท/๐š๐š’๐š๐š‘๐š๐šŽ๐š›๐šœ?๐š๐šŽ๐š๐šŠ๐š’๐š•๐šœ=๐Ÿท"))

When you press ENTER โŽ the URL should resolve, and you should see an unformatted string of JSON data, as in the screenshot.

โน Request data from the API

The next step is to specify which data from the unformatted string of JSON data in cell A1 we want to display in each cell. Before I do this though, I have added some column headings and a bit of formatting to my spreadsheet. I have opted to shrink the JSON output in cell A1 to fit the cell width, and to hide it away using matching foreground and background colours. Simple but effective. You can make yours white on white if you like, but I made mine grey to visually remind us that cell A1 is where the JSON data is. At this point it is a good idea to open the JSON data in your web browser as well, so that you can easily see the names of the fields that you want to work with. In cell A3, type...

=๐™ฟ๐™ฐ๐š๐š‚๐™ด๐™น๐š‚๐™พ๐™ฝ($๐™ฐ$๐Ÿท,"๐š๐šŽ๐š(๐Ÿถ).๐š’๐š")

When you press ENTER โŽ the URL should resolve, and you should see the ID number of the zero'th element of the array of JSON data. If you change the ๐š๐šŽ๐š(๐Ÿถ) to be ๐š๐šŽ๐š(๐Ÿท) instead, then you will end up with the "oneth" elementh. That is not quite the same as the "first" element, because arrays start their numbering at zero, not one. Anyway, the same applies for ๐š๐šŽ๐š(๐Ÿธ), ๐š๐šŽ๐š(๐Ÿน), etc. Also, to specify a different field, just change the fieldname after the ๐š๐šŽ๐š() part of the instruction. For example, we can get the .๐šž๐šœ๐šŽ๐š›๐š—๐šŠ๐š–๐šŽ field for the "zeroth" element of the array by typing in cell B3 the following...

=๐™ฟ๐™ฐ๐š๐š‚๐™ด๐™น๐š‚๐™พ๐™ฝ($๐™ฐ$๐Ÿท,"๐š๐šŽ๐š(๐Ÿถ).๐šž๐šœ๐šŽ๐š›๐š—๐šŠ๐š–๐šŽ")

You now have all the tools you need to fill up your spreadsheet with rows and columns. To make things easier, you can copy/paste the formulas between the spreadsheet and a text editor and use macros or search/replace to generate the rest of the formulas you will need to populate the rest of the spreadsheet. I hope this is useful.


The textual content of this post is licensed as a Free Cultural Work using a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license, which grants all the four freedoms listed in the definition of free cultural works, including: โ‘  The freedom to use and perform the work; โ‘ก The freedom to study the work and apply the information; โ‘ข The freedom to redistribute copies; and โ‘ฃ The freedom to distribute derivative works. This license places three key restrictions on those freedoms: โ‘ค ๐๐จ ๐ƒ๐‘๐Œ ๐จ๐ซ ๐“๐๐Œ: You must not restrict access to the work using technical measures, or otherwise attempt to impose limitations on the freedoms above; โ‘ฅ ๐€๐ญ๐ญ๐ซ๐ข๐›๐ฎ๐ญ๐ข๐จ๐ง: You must give proper attribution to the author (๐“ฃ๐“ป๐“ฒ๐“ผ๐“บ๐“พ๐“ฎ๐“ต๐“ฆ๐“ฑ๐“ช๐“ป๐“ฎ) and retain the license notice; and โ‘ฆ ๐‚๐จ๐ฉ๐ฒ๐ฅ๐ž๐Ÿ๐ญ: You must release derivative works under an identical or similar license.

IMAGE CREDITS:
โ€ข The image used for the post thumbnail is a remix by ๐“ฃ๐“ป๐“ฒ๐“ผ๐“บ๐“พ๐“ฎ๐“ต๐“ฆ๐“ฑ๐“ช๐“ป๐“ฎ. It includes the dog-1773712 image created by GraphicMama-team, which has been released under a Creative Commons Public Domain Dedication 1.0 Universal (CC0 1.0) license.
โ€ข The image used for the horizontal rule separators throughout this post is an original created by ๐“ฃ๐“ป๐“ฒ๐“ผ๐“บ๐“พ๐“ฎ๐“ต๐“ฆ๐“ฑ๐“ช๐“ป๐“ฎ, using the (previously) red, white, and black triskellions, inspired by Mฤori tukutuku panels.

H2
H3
H4
3 columns
2 columns
1 column
9 Comments