Post by gamemaster3000
I would like an item database of classic for a little hobby C++ program I'm making to look at a combat log and re-build the player's stats from that log.
Old topics like this
https://www.wowhead.com/forums&topic=73656 say that it's not available but that's 10 years old.
Data from a webpage like this
https://www.wowhead.com/item=52021&xml is fine but when I use my little sample C++ web browser program (
https://www.boost.org/doc/libs/1_72_0/libs/beast/doc/html/beast/quick_start/http_client.html) it can connect to wowhead.com.
However, when I change the "target" to "/item=52021&xml" I get a 301 resource moved error.
Am I requesting the wrong address, or is my computer program broken, or is there a difference between the way Chrome is asking for the data and the way my C++ program is asking for the data? I'm trying to avoid learning the whole HTTP GET request syntax, it's not my focus.
I also took a look at the Blizzard API but I don't understand how their authentication works yet.
Also...this data is not easily accessible in the client files is it?
Thanks so much!
Post by Erorus
Hi there,
First, I would recommend against using Wowhead's item XML data.
We tried to remove it last year but so many old projects still used it that we restored it. Regardless, we consider it deprecated and do not plan on making updates to it or fixing issues with it. Instead, you are encouraged to use Blizzard's APIs.
Second, I'd need to see the entire URL you're using that returns an HTTP 301 error. However, I'm gonna guess you're using HTTP and we require HTTPS. Be sure you're fetching
https://classic.wowhead.com/item=19019&xml. After looking at your example link some more, I'm pretty sure you're using HTTP on port 80 and that's your problem. The modern web uses HTTPS on port 443. You probably need to use something like
their SSL implementation.
Item data is in the client files, but "easily" is relative and I believe you'd be better served learning how to use Blizzard's APIs instead.
Here's how you use Blizzard's API to get item details:
- Create a client app on Blizzard's site. You'll be given a "client id" and a "client secret". You do this once.
- Get your access token. You do this once every 24 hours.Send a GET request to Blizzard with your client ID and your client secret.
https://us.battle.net/oauth/token?grant_type=client_credentials&client_id=CLIENTID&client_secret=CLIENTSECRET - You'll get back JSON with an access token that looks like this:{"access_token":"asdfASDFasdfASDF", "token_type":"bearer", "expires_in":86399}
Send a GET request for the item data using your access token.
https://us.api.blizzard.com/data/wow/item/19019?namespace=static-classic-us&locale=en_US&access_token=asdfASDFasdfASDF
It's just that easy.
Check out Blizzard's API reference for the latest information on available endpoints and how to use them. You can use their tool with your own client ID and client secret (or your own access token) to see example requests and responses.(##RESPBREAK##)
Post by gamemaster3000
That was very helpful, thank you.
However according to
https://us.forums.blizzard.com/en/blizzard/t/is-it-possible-to-get-item-stats-from-the-api-for-classic-wow/2819 an item's stats aren't available from the Blizzard API so I will need to get the data from the .xml files here I guess.