Archive for the 'SearchAPI' Category

JSON API Tweaked + example data

I’ve altered the SL Search API to always return the “url” field, and also replaced the “uuid” field for events (which returned incorrect data) with an “id” field that correctly marks the ID.

All current bugs in regards to returning blank or null fields have been fixed. In addition, I have added to the URLs for the search (actually it did this before, but I forgot to document it)

It can now accept the following format:

http://services.katharineberry.co.uk/search/search/(main|teen|mature)[/(all|classifieds|events|groups|people|places|wiki)]/search+term[/page-number]

The new parameter is in bold, and is entirely optional. It sets the category through which to search. Some example URLs:

http://services.katharineberry.co.uk/search/search/teen/test+search – A search for “test search” on the TG
http://services.katharineberry.co.uk/search/search/teen/groups/Group – A search for “Group” in all TG groups
http://services.katharineberry.co.uk/search/search/teen/places/Land/2 – Page 2 (results 11-20) of a search for “Land” in all TG places
http://services.katharineberry.co.uk/search/search/main/test+search – A search for “test search” on the MG
http://services.katharineberry.co.uk/search/search/mature/test+search – A search for “test search” on the MG, with mature results enabled.

Click here for examples of each type

JSON SL Search API

I’ve made a JSON-based interface to the new SL search, which provides access to all data available (I think).

All the methods have the base URL http://services.katharineberry.co.uk/search/.

Firstly, the search itself. This provides acccess to either MG or TG search, and provides information about all results on the page. It also supports specifying a page.

The format is as follows:

http://services.katharineberry.co.uk/search/search/(teen|main|mature)/search+string[/page-number]

The /page-number must be an integer, and is optional. If you use “teen” you get TG results, “main” gives MG results, and “mature” gives MG results with mature enabled. The output, assuming you know what JSON is, is fairly self-explanatory.

Additionally, you can access a bunch of other data:

http://services.katharineberry.co.uk/search/classified/required-uuid

http://services.katharineberry.co.uk/search/place/required-uuid

http://services.katharineberry.co.uk/search/resident/required-uuid

http://services.katharineberry.co.uk/search/region/required-uuid

http://services.katharineberry.co.uk/search/event/eventid

http://services.katharineberry.co.uk/search/group/required-uuid

Excluding events, all of the above expect a UUID in place of “required-uuid”. They can take both hyphenated and unhyphenated UUIDs. Events expect an Event ID, which are currently seven digit integers.

It can also pick out up to the top 100 popular places (I could do more – up to 50,000 – but capped it at 100 to save my server from certain death). The format for this is as follows:

http://services.katharineberry.co.uk/search/popular/(main|teen)/count

Using “main” gets MG data, “teen” gets TG data. “count” specifies the number of results to be returned.

Finally, as a bonus feature, if you have a key and have no idea what it’s for, put it in like this:

http://services.katharineberry.co.uk/search/unknown-uuid

This will make it search through the classifieds, parcels, residents, regions, events, groups, and textures. If it’s any of the above (except textures) it’ll return the same output as the standard services, with the added property “uuidtype” being set to one of the above. If it was a texture you only get the uuidtype. Please note that this takes several seconds to run, and is a relatively heavy job for my server.

I hope someone finds some use for this. Personally, I plan to use it in AjaxLife.