Splinterlands Data Exploring For Beginners
4 comments
This article is for those wanting to get a start, and this is just a start, about exploring your battle data in Splinterlands...hopefully for those less technically inclined, although this will still require some tech savvy.
First Step: Obtaining Your Battle History in JSON
Splinterlands provides an API, Application Programming Interface, that helps software outside of itself to work with its data. To access the Splinterlands API in a basic way to obtain your battle data, use the following link in a browser, replacing <your_player> with your own player name:
https://api2.splinterlands.com/battle/history?player=<your_player>
What you receive back may be overwhelming, for it will look something like the following:
...which can be a lot to take in.
Don't Panic!
The returned data is in a JSON form, which can be more easily read by code and spreadsheet apps like Microsoft Excel, or free applications like OpenOffice or LibreOffice. Once imported into a spreadsheet program, one (and only one) battle will appear as a row with various columns like the following:
In Excel, this can be done by going to its "Data" tab, then "From File," and then selecting From JSON:
So, back to the Excel file, each row has in itself some very useful information like the two player names, created date, match type, mana cap, etc. However, if you needed details like what cards were used, that is embeded into field labeled "details" with more JSON within:
Take that data, and the convert it from JSON and we can see more details, starting with a first level:
...then when Team1's details are examined we see even more embedded data:
...then when "Monsters" are examined, we see even more embedded data:
...which are just the six slots of monsters. Clicking on the first monster reveals its details:
...which reveals a card id of "162" which is Living Lava.
How Can I Make This Easier?
One of the easiest tools to use, other than a Spreadsheet's internal JSON conversion tools, is to use some sort of JSON to CSV/Excel converter like the following:
JSON To CSV Converter
The following does require more technical skills, but the other option is to use a script, and hopefully one you do not have to rewrite. One that I like is "battlesGetData.js" from the "splinterlands-bot" on GitHub:
splinterlands-bot on Github
Direct link to script:
Direct link to script
...which cleans up the data and adds it to a history.json file. A user then would use the combine.js:
Direct link to script:
Direct link to script
...that takes the history.json file, and then combines it with whatever is in newHistory.json, and writes it out as a new "newHistory.json" file. This newHistory.json file would be the one to explore.
Link to some documentation about the Splinterlands SPI Itself:
Link to some documentation about the Splinterlands SPI Itself
All of the above can be difficult or easy depending on previous knowledge. I am assuming someone would know the basics of Excel and navigating through some of these windows. Hopefully it is not too sparse of documentation to follow! Please let me know of any needed clarifications or needs of expanding on any items above.
This is just a starter about exploring data in Splinterlands! This can lead to better team formation, and learning from past battles.
Take care and happy exploring!
Comments