PDA

View Full Version : HEX Database API



cwik
06-22-2015, 11:57 PM
Hey Community,

I have been looking for a simple JSON API for HEX card/item data for a while now, but couldn't find anything, so I built one off of the database of doc-x' search engine (http://www.doc-x.net/hex/).

The first version is very basic. There is only one API node (objects) with all cards and items and a subset of all parameters exposed to the API at the moment, since some fields are not consistent, but it should be more than enough for the moment.

Links:
Documentation (http://hexdbapi2.hexsales.net/docs) (v1)

dbug
06-23-2015, 12:44 AM
That is really cool. I will release a Hex related project in the near future and your api will enable me to add more feature.

Thanks man!

Do you extract the data from the unity files?

Gattou
06-23-2015, 01:05 AM
Hi,
Great work man, can you add parameters like page_number and items_per_page ?

Ariathor
06-23-2015, 01:27 AM
That is pretty amazing, I've been looking for something exactly like this for some time.

cwik
06-23-2015, 06:30 AM
I added a simple limit and offset parameters and updated the documentation.

MugenMusou
06-23-2015, 07:20 AM
Wow. Impressive work. Thank you.

05K4R
06-23-2015, 08:26 AM
How will multishard cards be represented?

Yoss
06-23-2015, 09:22 AM
I love watching our tool set grow. Nice work!

cwik
06-23-2015, 10:11 AM
How will multishard cards be represented?

Good question! I'm actually updating the documentation right now, because I realized that it is kind of lackluster. As far as I know multi-shard cards are not represented in any special way, but their "color" value are comma+space-separated shard values. So Army of Myth would be "Ruby, Diamond" and its threshold value would be "2 Diamond, 2 Ruby". As you can see both versions sort their shard values differently, but please don't ask me why this is the case^^. Anyway I'll probably make a bigger documentation update tonight and get some insight into the data to explain how it works.

EDIT: I just updated the documentation. It should be more useful now.

Patrigan
06-24-2015, 01:38 AM
I wonder though, if doc-x's tool will remain working. Did he already find the new location of the information? Last time I checked, the data is now encrypted :(

cwik
06-24-2015, 04:37 AM
I asked Chark for help on this and he said we would see some support here.

DocX
06-24-2015, 06:31 AM
Good question! I'm actually updating the documentation right now, because I realized that it is kind of lackluster. As far as I know multi-shard cards are not represented in any special way, but their "color" value are comma+space-separated shard values. So Army of Myth would be "Ruby, Diamond" and its threshold value would be "2 Diamond, 2 Ruby". As you can see both versions sort their shard values differently, but please don't ask me why this is the case^^. Anyway I'll probably make a bigger documentation update tonight and get some insight into the data to explain how it works.

EDIT: I just updated the documentation. It should be more useful now.

cwik, I'm very sorry about changing this without telling you ahead of time. With the move to multiple thresholds, the workaround I had in place for The Triumvirate wasn't going to work anymore. Next time I do schema changes (and it'll result in output changes) I'll do my damnedest to remember to give you a heads up.


I wonder though, if doc-x's tool will remain working. Did he already find the new location of the information? Last time I checked, the data is now encrypted :(

It is non-obvious how to access the data. I was graciously given pointers by Hex folks (assisted by Phenteo) as to where and in what format the data is stored. I'm not going to make that information public without Phenteo, Chark or someone similar giving the go ahead (primarily because I said I wouldn't unless explicitly told I could).

I don't imagine the way the information's stored will change, but since I'm not on the engineering team, I can't make any assurance of that. If things do change and I'm not able to suss it out on my own, I'll again ask the kind folks from Hex for guidance and hope they are gracious again.

If something is fundamentally broken with my tool suite/website and I am aware of it, I'll publicize it as much as I can so anyone relying on it for information will be aware and can take appropriate action. I'm hopeful that won't happen. There may be instances where I don't have the free time to address bugs and such, but if I'm aware and I can find a spare few hours, I'll do my best to make sure everything's working as expected. Not a guarantee, but the best I can do until Hex (or someone else) hires me and I can justify the extra time to my wife and kids ;-)

Patrigan
06-25-2015, 04:10 AM
cwik, I'm very sorry about changing this without telling you ahead of time. With the move to multiple thresholds, the workaround I had in place for The Triumvirate wasn't going to work anymore. Next time I do schema changes (and it'll result in output changes) I'll do my damnedest to remember to give you a heads up.



It is non-obvious how to access the data. I was graciously given pointers by Hex folks (assisted by Phenteo) as to where and in what format the data is stored. I'm not going to make that information public without Phenteo, Chark or someone similar giving the go ahead (primarily because I said I wouldn't unless explicitly told I could).

I don't imagine the way the information's stored will change, but since I'm not on the engineering team, I can't make any assurance of that. If things do change and I'm not able to suss it out on my own, I'll again ask the kind folks from Hex for guidance and hope they are gracious again.

If something is fundamentally broken with my tool suite/website and I am aware of it, I'll publicize it as much as I can so anyone relying on it for information will be aware and can take appropriate action. I'm hopeful that won't happen. There may be instances where I don't have the free time to address bugs and such, but if I'm aware and I can find a spare few hours, I'll do my best to make sure everything's working as expected. Not a guarantee, but the best I can do until Hex (or someone else) hires me and I can justify the extra time to my wife and kids ;-)

I know that in the past it was really simple to get the info. But my short adventures on the test server proved fruitless. Well, not really, I think i did find the files, but they're in an annoying format which you can't easily open. (and I could still be wrong about that). So I just gave up and I hope CZE will someday give us a good api to get the data as it is in the game.

Now to give some meaningful feedback to both of you:
Can you try and convert the current list of tags (subtypes) into a list instead of a string. I know not all of them are meant to be completely split (like the high cleric tag), but it would be easier if some are. A good reason for this is to get a list of all the robots, but now there's a dwarf robot. He counts as a robot, but you can't just select on it. My proposal is a conversion to an ordered list, where the original string is split on the spaces. Keep the list in order of the appearance of the tags. (Ideally someday CZE will actually store it as a list).

cwik
06-25-2015, 05:14 AM
Well that certainly sounds like something I can provide with some api sugar. I'll look into it the next few days.

DocX
06-25-2015, 07:11 AM
Patrigan, this information is stored as a string inside the data file. In order to tokenize that on my end, I'd need to do the same thing you'd be doing: split up on spaces. And this would work well for some things ("Undead Zombie Abomination", "Robot Beast", "Vennen Rogue", etc) and not so well for others ("Avatar of Destruction", "Avatar of Lust", etc).

As far as being able to select on that field, I'm not sure what database you're using, but under MySQL this works for me to get all of the robots:

mysql> select name, sub_type from cards where sub_type like '%Robot%';

Pretty sure that works in pretty much anything that does semi-standard SQL.

cwik
06-25-2015, 09:55 AM
I made so your query with sub_type=robot gives you any kind of robot.

EDIT: My bad, we obviously don't want this behaviour for parameters like rarity (with (Un)Common).

cwik
07-05-2015, 03:30 AM
A type of a card now has an array of strings rather than a string holding all types.
Example: Basically any Artfiact
before: type: "Artifact, Troop"
now: type: ["Artifact", "Troop"]

This only affects the result document, but not the way of querying for multi-type cards.

cwik
07-24-2015, 04:24 PM
Updated with DocX' new data.

cwik
10-12-2015, 06:03 PM
I'm taking down the server for a few hours or maybe a day. The api will not be accessible during that timeframe.

cwik
10-13-2015, 05:49 AM
The api is back up at http://hexdbapi.hexsales.net.

cwik
01-31-2016, 12:00 PM
Hi,

as my first step to upgrade my code infrastructure I've built a new version of this database api. Whoever is in need of some queriable and dynamic interface to find data for cards, equipment, champions, etc. should check it out. For those of you who are not developing any kind of application for hex, this is probably nothing for you :(.
The code is publicly available on GitHub (https://github.com/maximumstock/hex-database-api) where you can also find the documentation. It updates the data daily by parsing search results from doc-x search engine (http://doc-x.net/hex/).

The api is available under http://hexdbapi2.hexsales.net (the old one is still running but I'll probably take it down in the near future) and is versioned, with version 1 currently available.
You won't find any documentation under that url, so please go to GitHub for that.

EDIT: Please look that the documentation (https://github.com/maximumstock/hex-database-api/blob/master/APIDOC_V1.md) before doing anything else.

Svenn
01-31-2016, 01:03 PM
The api is available under http://hexdbapi2.hexsales.net (the old one is still running but I'll probably take it down in the near future) and is versioned, with version 1 currently available.
You won't find any documentation under that url, so please go to GitHub for that.

This link just gives me a page that says "Not Found".

cwik
01-31-2016, 01:08 PM
This link just gives me a page that says "Not Found".

Yup, thats how it is supposed to be as it is just the main url the api is mounted at.

Svenn
01-31-2016, 01:57 PM
Yup, thats how it is supposed to be as it is just the main url the api is mounted at.

Okay, I removed the 2, which I assume is the old version, and there was a front page there for the API. Thought this one was supposed to be the same. ;)

cwik
02-13-2016, 11:13 AM
I updated the documentation and made it available under http://hexdbapi2.hexsales.net/docs/index.html. If there are any questions, feel free to ask.

silvercrown
02-23-2016, 01:03 AM
This is very cool! Thanks for making this available. I dug around a bit and the API seems to work very well.

Ariathor
03-23-2016, 10:25 AM
This is extremely useful, thank you for the time you've put into this.

If I might make a suggestion, it might be nice to add uuid to the documentation, I kept wondering why you had removed it (since I remembered it being included in the first ever version), until I tried it out for myself. It also might be right to add the complete URLs for making the requests (easier to copy-paste and might prevent some confusion too).

cwik
03-23-2016, 01:00 PM
Hey, thanks for your feedback.
I added support for searching by uuids.