Waivio

Recommended Posts

Splinterlands Data Exploring For Beginners

4 comments

elebrum0.733 years ago3 min read

https://images.hive.blog/DQmf9SdFDK858dPc8Msue3XAouvhqzu6oqAPLkZpG5TFdu3/title-dataForBeginners.jpg

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:
https://images.hive.blog/DQmNtXgNutzYUzAQ6msYPmM411vALQ5pLJXY5KHQvXb3TTz/json_from_api-a.png
...which can be a lot to take in.

https://images.hive.blog/DQmfErBQjdwYM47hXYDg9W3hk9qedoDvvfzFncjGQJndKac/divider-splinterlands.png

Don't Panic!

https://images.hive.blog/DQmWZbp8dytVhWZkWw5aZ7sD7R4LjtqZWTimzDCra9FNsbg/dont_panic.png

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:

https://images.hive.blog/DQmbaep2FdVTrAC721SQY4TQjrwxyxeBFZK4wx3zAu54UjX/firstrow-a.png

https://images.hive.blog/DQmQunv7BKhfK6kSzPFyVRbiy738y8XcGS4NzLvpe3xwGbi/firstrow-b.png

In Excel, this can be done by going to its "Data" tab, then "From File," and then selecting From JSON:
https://images.hive.blog/DQmc7gdsXBTd59mAdyQCGEQisrniW3jMePJpGVoh8fJdTq3/excel-a.png

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:

https://images.hive.blog/DQmQunv7BKhfK6kSzPFyVRbiy738y8XcGS4NzLvpe3xwGbi/firstrow-b.png

Take that data, and the convert it from JSON and we can see more details, starting with a first level:

https://images.hive.blog/DQmaFMKbbznAWBAgeSxDBvm6uRfr8aCNqpZospH6zgu6VNB/detail-a.png

...then when Team1's details are examined we see even more embedded data:
https://images.hive.blog/DQmbFJaEhuqgxTD5j9LXfbdGppAwbEa9jT8FhqAEAzq3UeV/detail-team_one.png

...then when "Monsters" are examined, we see even more embedded data:

https://images.hive.blog/DQmT1VFWwsNzZzNauhHpdVff6p19CgSyummyrLUv456TLrE/detail-monsters-list.png
...which are just the six slots of monsters. Clicking on the first monster reveals its details:
https://images.hive.blog/DQmSan5yZ85rdDKFybySu8ywUSH3aFRTrLK8VfbsLRV4Kpf/detail-monsters.png
...which reveals a card id of "162" which is Living Lava.
 
https://images.hive.blog/DQmbSybvrA6LaMN4spSN4aeNGXfVGUwzM8Mxb8Fv7nkmKy9/divider-a.png
 

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

https://images.hive.blog/DQmVEM66jwgNa3eUCzdkzaXueAgQ31rQwiDcXfKi6yPesPh/divider-hiva-a.png

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.

https://images.hive.blog/DQmU41nEpE4KBko6RYAVhfZ5kwA1Jb41xwyMp1oAUrMNd3c/divider-hiveb.png

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

Sort byBest
AI
Waivio AI Assistant
How can I help you today?