https://bugzilla.wikimedia.org/show_bug.cgi?id=38716
Web browser: ---
Bug #: 38716
Summary: API should use status codes for errors
Product: MediaWiki
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: API
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Classification: Unclassified
Mobile Platform: ---
I think it is terrible that the API doesn't make use of response codes more. As
a javascript developer it seems completely wrong to me that I have to mix
error handling with success handling.
I understand there are backward compatibility issues but it should be possible
to access an alternative flavour of the API (E.g. accessed via
http://en.wikipedia.org/w/apiv2.php)
for example it would...
return 404's when I request a page that doesn't exist
a 400 bad request when I provide the wrong parameters
and 403 Forbidden when I try to do something I am not authorised to do
Some of the time when writing code that error handles I want to be able to
quickly handle errors without resorting to inspecting the contents of the
response e.g. on a 403 I can deduce that the user is not logged in or has
irrelevant permissions and trigger a relevant call to action (e.g. redirect to
login page/inform the user they are trying to do something they are not
supposed to).
The existing response text would be packaged in the response body for
situations where it is really needed.
I believe such a change would make the API more attractive to developers and
easier to explore. Please lets do something about this.
See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l