views:

40

answers:

1

I got a backend web service containing massive amounts of data that I have control over and I need to fetch data from it through a browser frontend. The frontends task is to simply display the data in a paged table but the user should be able to dynamically constrain the data based on the fields and i can't load the entire matching data set in one load.

What I'm looking for is some standard language to use to define the constraints that preferably should already have a mature implementation for either ruby or java and even javascript.

A: 

RESTful services use standard HTTP requests. You can use any number of query parameters to filter your results. For example, to fetch all products (in XML) with a price greater than 50 you'd send a GET request to the following URL:

http://my.web.service.com/v1/products.xml?price_gt=50

Since you have full control over the web service, it is you who has to decide what kind of filtering should be available, and via which parameters. You could, for example, also add an offset and limit parameter to fetch a specific amount of records.

For a browser-based client, you'd need an HTML representation of your resources/records. Most web applications have a filtering form with the available filtering parameters. In my previous example, I could add a simple text field for full-text search in the products' title/description and a couple of text fields or select menus to allow the user to fetch products within their preferred price range.

The way I see it, there is no standard way to define a filtering language and web interface, as it all depends on what data and filtering capabilities you want to provide to your users. It also depends on the language the web service is written in and whether you need a simple HTML UI or an AJAX-driven UI on the client side.

Teoulas
Yea, that would work. I were just hoping on that someone had already come up with a nice solution that could convert a simple predicate in say the form "field1>=10 AND field2==asd" to a safe argument to an orm. Guess I'll have to stop being lazy and just do the work instead... Thanks for the help!
Andreas
What language/framework is your web service written in? On Ruby on Rails, there's searchlogic, which makes filtering forms a piece of cake.
Teoulas