Diablo® III

API inconsistencies

You can grab someone's career profile with /api/d3/profile/btag-id/ but if you omit the trailing forward slash the request fails.

However, if you want to access a certain hero for that user by doing /api/d3/profile/btag-id/hero/id it works but if you add the trailing forward slash it fails.

It's not a big deal but it seems like something you guys should make consistent on your end.
Edited by viscrom#1983 on 8/31/2012 1:50 PM PDT
Reply Quote
It seems anything that returns multiple items, such as a profile (multiple heros) or follows can have a trailing slash.

Think of it as a directory with files in it. Your profile is a directory, each hero is a file. Same goes for artisans and followers

/api/d3/data/artisan/
/api/d3/data/follower/

You would think you can go to /api/d3/data/item/ and get a list of ALL items in the game, but alas, it doesn't work, and I doubt it ever will. It would be a rather expensive call
Reply Quote
I'm not aware of any API good practices which recommend that end points that result in returning an array should end in a trailing slash.
Reply Quote
Oh, I see what your are saying now. The slash is REQUIRED and probably shouldn't be. I misunderstood your concern.

I agree the slash shouldn't be required.

What I have noticed is that it maps to the "index" file. these both go to the same place

http://us.battle.net/api/d3/data/artisan/index
http://us.battle.net/api/d3/data/artisan/

The same thing is true about your profile page
Reply Quote
09/01/2012 06:09 AMPosted by femor
these both go to the same place


Not necessarily. Each directory can have a different index file, depending on the configuration of the server. i.e. http://www.htaccess-guide.com/directoryindex-uses/
Reply Quote
09/03/2012 02:02 AMPosted by NetJunky
these both go to the same place


Not necessarily. Each directory can have a different index file, depending on the configuration of the server. i.e. http://www.htaccess-guide.com/directoryindex-uses/


He's referring to this API specifically.. not saying it holds true for every directory everywhere
Reply Quote
09/03/2012 03:42 AMPosted by Urza


Not necessarily. Each directory can have a different index file, depending on the configuration of the server. i.e. http://www.htaccess-guide.com/directoryindex-uses/


He's referring to this API specifically.. not saying it holds true for every directory everywhere


Correct. Also they are using Tomcat, htaccess files are ignored on that server.
Reply Quote
I did a little research and it seems mixed (just as I suspected). Some popular APIs use the trailing / on resources that return 1 or more results and others do not.

Twitter for example doesn't seem to use trailing slashes on anything according to their docs:
https://dev.twitter.com/docs/api
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)
Submit Cancel

Reported!

[Close]