[Developers] minor change in search api behavior (empty result set will no longer be an error)

David Flanagan david at davidflanagan.com
Fri Jul 18 21:59:19 UTC 2008


Warren Harris wrote:

>> My point, I guess, is that if there is a worry, even in this case, that
>> too many developers already do strict equality tests rather than prefix
>> tests, then I can't imagine it will ever be acceptable to return an
>> extended ok code.  And we ought to just give up and document that it is
>> okay to do a strict equality test on the status code!  It would
>> certainly simplify everyone's error testing code to be able to use ==
>> instead of indexOf or a regular expression match!
> 
> It sure would. What are the other documented cases where developers have 
> to use a prefix comparison for success?

I'm not aware of any services that ever return anything other than 
/api/status/ok on success.  I've assumed that doing a prefix match was a 
matter of future-proofing your code in case a service return something 
more detailed in the future.

> (Looking through the code, I only see this done for login/logout, but 
> maybe that's outside the scope of mql.)

It looks like login and logout both return /api/status/ok, too, though 
login returns a more detailed success code inside of the messages array. 
  (I normally don't expect messages when the code is /api/status/ok...)

	David

> Warren
> 
>>
>>
>>     David
>>
>>
>>> The bottom line is that returning no results (empty list) is not an
>>> error. I'd even vote for striking the message from the result.
>>>
>>> Warren
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Developers mailing list
>>> Developers at freebase.com
>>> http://lists.freebase.com/mailman/listinfo/developers
>>
>> _______________________________________________
>> Developers mailing list
>> Developers at freebase.com
>> http://lists.freebase.com/mailman/listinfo/developers
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers



More information about the Developers mailing list