wiki:WebserviceGetExamples

Webservices GET Examples

List My Projects (GET)

Open your favourite browser and type the following in the URL

http://localhost:8080/proteios/resource/projects?username=john&password=cow

You should see a tabdelimited result similar to

 Id
 2
 3

I have entered two projects using the web client and those are their ids. The service result format is tab delimited with the first row being the header. Now this doesn't tell you much. You probably want to know the project names as well. When sending a GET message to the service we have tried to use the SQL syntax for query parameters so if you want to query for the Id and Name for all your projects write the following in the browser URL

http://localhost:8080/proteios/resource/projects?username=john&password=cow&select=Id&select=Name

You should now see

Id      Name
2       Little piggy project
3       Big cow project

Looks nice. How about listing all available properties for all my projects. Just enter select=* like this

http://localhost:8080/proteios/resource/projects?username=john&password=cow&select=*

This will list the entire table, including the content of all rows. If you just want to list the available properties, look in the next section:

Advanced GET requests

It's also posibble to query for data using SQL statemets such as where, order by and limit. Here's an example showing how to list all projects containing the word project and ordering them by descending Id

http://localhost:8080/proteios/resource/projects?username=john&password=cow&select=*&whereName==%25project&orderById=desc

As you can see wildcards are possible. The wildcard token is '%' and it must be escaped when written in the URL thus becomming '%25'.

To get the properties that are possible to filter on, without listing the content of the table, the following will do:

http://localhost:8080/proteios/resource/projects?username=john&password=cow&select=*&whereId==0

To filter using less than or higher than, the syntax is wherePropertyName=>=number, for example

http://localhost:8080/proteios/resource/projects?username=john&password=cow&select=*&whereId=<=10&orderById=asc

The above example will listen (in ascending Id order) all projects which john has access to with an project id of 10 or lower.

Last modified 13 years ago Last modified on Jun 2, 2009, 3:11:14 PM