GwentAPI / gwentapi

The code for GwentAPI
https://gwentapi.com
BSD 3-Clause "New" or "Revised" License
47 stars 1 forks source link

Resources href/uuid seem to change #24

Closed zhouzi closed 7 years ago

zhouzi commented 7 years ago

I cached the list of cards from the entry point. But then, when trying to fetch a card from its href I get a code 500. My understanding is that the uuid may change when cards are crawled again but I may be wrong.

If that's the case, it'd be great to conserve the same uuid somehow.

Note that GwentAPI/arachas/issues/5 could improve the caching system and kind of fix this issue.

Tri125 commented 7 years ago

Yes, you are spot on. This is exactly the problem and the solution.

However, you should have got code 404. Do you still remember the href that you tried?

zhouzi commented 7 years ago

I'm not sure but it was probably: https://api.gwentapi.com/v0/cards/BR2eUr1hQTK5sudkU-8S2Q

It seem to throw a 500 any unknown value though, e.g: https://api.gwentapi.com/v0/cards/123

Tri125 commented 7 years ago

Ok I found the problem, it will be fixed shortly. I forgot to check the specific error on the queries with the database to see if it was not found or if there's really an internal error.

Tri125 commented 7 years ago

It should now correctly throw 404 88ae2a9cc3b822c2a124d1ab18371305892e5041 . Keeping the issue open as href/uuid does change and shouldn't.

zhouzi commented 7 years ago

Awesome mate, your work is highly appreciated 👍

Tri125 commented 7 years ago

This should be improved on the next release (commit not pushed at the moment). On the next release the UUID will be regenerated using UUID5 which will allow the API to offer a stable and predictable UUID.

UUID5 is generated by giving with a namespace uuid and a name (some data). For the same namespace and name, the same uuid will be generated. The namespace will be a randomly generated uuid4 that will stay constant, the name will consist of the en-US name of the resource in question (ie: Arachas for the Arachas card). For the variation it will be the en-US name of the card that it refers to appended to the availability (the set which it comes from).

Unless the name of the resource change, the UUID should stay the same.

Tri125 commented 7 years ago

Should be fixed in 1102f3b