Lately, my thoughts have been jumbled and disorganized, specifically regarding wahmen. So here is my first attempt to codify the Wahmen API. Yes, we are working with an unknown API in a cryptic language, so the progress is slow. However, fellow wahmen researcher/coworker, Daniel, provided his invaluable insight into the following response statuses.
Before we get started, lets start with methodology which is as follows:
1. can the behavior be replicated?
2. if preceding question is true, do the debug or error logs show anything?
3. if preceding question is true, document wahmen API call
The following API calls were replicated and confirmed in text logs for multiple coworkers.
unRESTful Wahmen API:
GET requests:
- Request: GET https://wahmen/apiv1/howareyou?wahmenName=girlyoulike
Response:
{
"error": {
"code": 202,
"message": "I need me time"
}
}
*Message may also be "I need space" or even "You're a dick"
2. Request: GET https://wahmen/apiv1/randomeveningchat?wahmenName=girlyoulike
Response:
{
"error": {
"code": 226,
"message": "I'm talking to other guys."
}
}
These are the only two known API calls I’ve found so far. But as you can see there is an issue: why are 200 series status code being returned with an error and a message that indicates something is not ok.
Fortunately, fellow brogrammers have already discussed this issue as outlined here:
stackoverflow.com/questions/9794696/how-do-i-choose-a-http-status-code-in-rest-api-for-not-ready-yet
As the stackoverflow user “Andy” noted, if the object is not GET-able, then it shouldn’t even be requestable (I’ve changed some words to better fit this situation): “First, if a request does not yet have any GET-able representation, in what sense does it exist as a resource (from the guy’s perspective)? The fact that, internal to the wahmen there is a queued job to create a reply, doesn’t seem to imply that resource “how are you?” exists. Second, where did the guy get the URI …/apiv1/howareyou? The wahmen probably shouldn’t have provided that URI to the guy until the resource was actually GET-able.”
Agreed. The 200 status code is misleading. That is the crux of the problem. The Wahmen should return a 500 series code in response to our well formed request, not a 202 accepted, to indicate an issue on the wahmen side. This point is elucidated as follows:
“Response status codes beginning with the digit “5” indicate cases in which the wahmen is aware that it has erred or is incapable of performing the request… the wahmen SHOULD include an entity [indicating] whether it is a temporary or permanent condition.”
Where is the indication of temporary or permanent condition in response to our request? Are we supposed to resend the GET request? Did the wahmen mean to send a 404 or maybe a 403, maybe I’m looking for the wrong resource?
In conclusion, I’ll continue to update the API with any new discoveries.