fdiotalevi / OSGi-RestConsole

A rest console for R4 OSGi containers

Home | Edit | New

UseTheRestConsole

To interact with the Rest Console you need a Rest Client (What is Rest?). The best out there is cUrl which runs on a variety of operating systems. If you need to integrate it in a Java application, you may want to check the Apache HttpClient project .

In this page I will use cUrl.
restserver denotes the URL of the server where the Rest Console is running, for instance http://localhost:8080

Working with bundles

Get the list of bundles
- in xml format → make a HTTP GET request to restserver/restconsole/bundles
i.e.
curl restserver/restconsole/bundles
- in txt format → make a HTTP GET request to restserver/restconsole/bundles/.txt
i.e.
curl restserver/restconsole/bundles/.txt

Get the information of a bundle

make a HTTP GET request to restserver/restconsole/bundles/bundle-id
i.e.
show info of bundle 0 in XML format: curl restserver/restconsole/bundles/0
show info of bundle 3 in TXT format: curl restserver/restconsole/bundles/3.txt

Install a new bundle

- make a HTTP PUT request sending the bundle to install
i.e.
curl -X PUT -T /path/to/the/bundle.jar restserver/restconsole/bundles

Change the state of a bundle

- make a HTTP POST request specifying the bundle and the new state (ACTIVE, RESOLVED, UNINSTALLED)
i.e.
Start bundle with id 2: curl -d “state=ACTIVErestserver/restconsole/bundles/2
Stop bundle with id 5: curl -d “state=RESOLVErestserver/restconsole/bundles/5
Uninstall bundle with id 3: curl -d “state=UNINSTALLEDrestserver/restconsole/bundles/3

Working with imported packages

Show the imported packages of a bundle

- make a HTTP GET specifying the bundle id
i.e
Show imports of bundle 2 in XML format: curl restserver/restconsole/imports/2
Show imports of bundle 2 in TXT format: curl restserver/restconsole/imports/2.txt

Working with exported packages

Like imported packages, i.e.
curl restserver/restconsole/exports/2
curl restserver/restconsole/exports/2.txt

Working with bundle headers

Like imported packages, i.e.
curl restserver/restconsole/headers/2
curl restserver/restconsole/headers/2.txt

Working with exported services

Like imported packages, i.e.
curl restserver/restconsole/exported-services/2
curl restserver/restconsole/exported-services/2.txt

Working with imported services

Like imported packages, i.e.
curl restserver/restconsole/imported-services/2
curl restserver/restconsole/imported-services/2.txt

Last edited by fdiotalevi, Mon Aug 24 03:16:40 -0700 2009
Home | Edit | New
Versions: