JSON service now with Search!

21 views
Skip to first unread message

rogerhyam

unread,
Sep 19, 2008, 7:36:37 AM9/19/08
to Biodiversity Collections Index
I have added a search method to the JSON service so that you can write
"almost arbitrary" queries across some 38 different fields in the
database and get the results back as JSON objects. There are =, > and
< for numeric and date fields. There are =, != , LIKE and NOT LIKE
operators for string fields. There is ordering, limit and offset.
There are also some bugs that I don't know about!

Please have a play and let me know what you think.

http://biocol.org/json

I have also refactored the existing fetch method for retrieving
collections by LSID. It should behave as before but I may have
introduced bugs so please be aware of this and tell me about them.

I am still returning each collection as a JSON object with some 40
fields in many of which will be null. I'd like opinions on how to
improve on this or whether I should. Options are:

1) change nothing.
2) don't return fields if they contain null (lots of space saved, easy
to implement server side by client side you have to keep checking if
properties are defined or not).
3) allow definition of fields to be returned (we still need to decide
what happens if no field list is defined).
4) require definition of fields to be returned (barrier to naive use
of the system).

All the best,

Roger

Mike Giddens

unread,
Sep 19, 2008, 9:51:57 AM9/19/08
to Biodiversity Collections Index
This is great news. I will defiantly try this out when I get back to
my office next Wednesday. From the docs it looks to cover most of
what could be needed so good job on such a quick implementation. I
will get back to you on your questions when I have a chance to run
some tests.

-Mike

Mike Giddens

unread,
Sep 22, 2008, 9:36:49 PM9/22/08
to Biodiversity Collections Index
Roger,

It seems that you are working on something with the json service. The
data is being returned but the header is now a 500 Internal Server
Error. This causes problems for using the service so this will need
to be resolved.

Just letting you know.

-Mike

On Sep 19, 8:51 am, Mike Giddens <mikegidd...@silverbiology.com>
wrote:

rogerhyam

unread,
Sep 23, 2008, 5:22:13 AM9/23/08
to Biodiversity Collections Index
Oops - my bug. Fixed now.

Reviewing the headers I have set the Content-Type to text/plain (It
was text/html). I see that there is talk of using text/json or text/x-
json. Unfortunately using either of these makes debugging in the
browser harder so I am sticking with text/plain for now. Is this OK?

rogerhyam$ curl -I http://biocol.org/json/search?code=e

HTTP/1.1 200 OK
Date: Tue, 23 Sep 2008 09:21:21 GMT
Server: Apache/2.0.59 (CentOS)
X-Powered-By: PHP/5.1.6
Set-Cookie: PHPSESSID=kfdmuhvnf19417ep8onqj7vau2; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0
Pragma: no-cache
Connection: close
Content-Type: text/plain


On Sep 23, 2:36 am, Mike Giddens <mikegidd...@silverbiology.com>
Reply all
Reply to author
Forward
0 new messages