wiki:Webservice

Version 19 (modified by Gregory Vincic, 13 years ago) (diff)

How to download a file through webservice

Webservice

As proteios develops the webservice interface will allow access to more data and in more elaborate ways. I'll give a couple examples of it's use below. I'll assume the following :

  • You have installed and created a user named john with the password cow
  • User john has entered some information to proteios such as projects, samples and hit reports.

General Usage

Our webservice follows the REST design which means it's stateless and relies on the HTTP protocol for communication. Basically the webservice will support, and does to some extent already, four of the most used methods GET, POST, DELETE and PUT. Using your favourite browser you can access GET and POST methods the other two are not implemented in most browsers today. Though there are free clients out there that you can use to send PUT and DELETE messages such as Curl. Here are some examples of how to use the service.

Examples

  • Get - Used to list data
  • Put - Used to add new data
  • Post - Used to modify existing data
  • Delete

FAQ

How do I download a file?

URL/files/FILE_ID?username=NAME&password=PASSWORD

How do I show all attributes of e.g. Samples?

URL/Samples?username=NAME&password=PASSWORD&select=*&limit=1

Can I filter on every attribute?

No, currently filtering is allowed on non linked columns, e.g. strings and integer values.

How do I impersonate another user

If you have the proper permissions you can impersonate another user with the 'impersonate' parameter e.g.

...?username=NAME&password=PASSWORD&impersonate=USERNAME

where USERNAME is the login name of the user you want to impersonate.

Test

There are a growing number of automated tests in client/servlet/test/src/webservice. To run all tests you can simply run

cd client/servlet/test/src/webservice
./run.sh all

Unless you specify the -v option, tests are run quietly. Errors however are written to STDERR.