Splinterlands Data Exploring For Beginners

avatar
(Edited)

titledataForBeginners.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:
json_from_apia.png
...which can be a lot to take in.

dividersplinterlands.png

Don't Panic!

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:

firstrowa.png

firstrowb.png

In Excel, this can be done by going to its "Data" tab, then "From File," and then selecting From JSON:
excela.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:

firstrowb.png

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

detaila.png

...then when Team1's details are examined we see even more embedded data:
detailteam_one.png

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

detailmonsterslist.png
...which are just the six slots of monsters. Clicking on the first monster reveals its details:
detailmonsters.png
...which reveals a card id of "162" which is Living Lava.

dividera.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

dividerhivaa.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.

dividerhiveb.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!



0
0
0.000
4 comments
avatar

This is a great starter guide. I was just starting to dip my toes into the API and this was a big help. Thanks!

0
0
0.000
avatar
(Edited)

Thank you! There is so much to go into! https://github.com/kiokizz/Splinterlands-API helps, but I think most would be interested in battle history. Although the same concepts, with different API calls, could be used to explore market history, leaderboards, upcoming tournaments, etc.

0
0
0.000
avatar

Congratulations @elebrum! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

You received more than 50 upvotes.
Your next target is to reach 100 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Hive Power Up Month - Feedback from February day 25
Happy 6th Birthday to the Hive Community
Introducing NFT for Peace
0
0
0.000
avatar

Thanks for putting together. Helpful. Sharing this on Splinterlands Digest Twitter.

0
0
0.000