thomastuts / hearthstone-api

0 stars 0 forks source link

Think about a good architecture for saving historical data for cards #3

Open thomastuts opened 10 years ago

thomastuts commented 10 years ago

Cards are bound to get changed from time to time, it'd be cool if we could store a version of a card of each patch.

One way of doing this would be performing an MD5 on a JSON string of the entire card, and then check to see if it matches with a previous card in the database, if there is one (we can use the filename as a unique ID since that will probably never change).

If it doesn't match, something must have changed and we can push it on top of the history stack. When people use the API to find cards, we only show the current card that is live. We could add a history state to the API that allows people to watch all previous version of a card. For example: /cards/EX1_132/history.

thomastuts commented 10 years ago

There are additional parameters found in the card data: version and CardID. I'm guessing the version is bumped every time they make changes to a card, which will make tracking changes a lot easier.

thomastuts commented 10 years ago

After reviewing the data, the version number is the same for every card and is probably not how they track changes. Maybe there's another way of tracking metadata like this in other asset files.