This repository has been archived by the owner on Jul 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Rest API
barjo edited this page Nov 22, 2012
·
28 revisions
The REST Api allows you to create and configure RoSe Machine through HTTP.
In order to use the REST API, you must deploy the Jax-Rs Exporter and its dependencies. The bundle which contains the REST API resources is:
<dependency>
<artifactId>rose-wui</artifactId>
<groupId>org.ow2.chameleon.rose</groupId>
<version>1.0.1-SNAPSHOT</version>
</dependency>
Method | Path | Type |
---|---|---|
GET, POST | /rose/machines | application/json |
GET, DELETE | /rose/machines/:id | application/json |
GET | /rose/machines/:id/instances | application/json |
GET, PUT, DELETE | /rose/machines/:id/instances/:instanceId | application/json |
GET | /rose/machines/:id/ins | application/json |
GET, PUT, DELETE | /rose/machines/:id/ins/:inId | application/json |
GET | /rose/machines/:id/outs | application/json |
GET, PUT, DELETE | /rose/machines/:id/outs/:outId | application/json |
The following section show you how to use the API with curl.
- Get the ids of the RoSe machine created through this API:
curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines
- Get the description of the machine :id
curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines/:id
- Create a new machine :id
curl -i -X POST -d '{ "id" : ":id" }' http://localhost:8080/rose/machines
you can also set the hostname :hostname
-d '{ "id" : ":id", "host" : ":hostname"}'
- Destroy the machine {id}:
curl -i -X DELETE http://localhost:8080/rose/machines/{id}
- Get the instances linked to the machine {mId}
curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines/{mId}/instances
- Get the description of the instance {inId}
curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines/{mId}/instances/{inId}
- Create the instance named {inId} from the component {component}
curl -i -X PUT http://localhost:8080/rose/machines/{mId}/instances/{inId}?component={component}
you can set some optional properties (as content)
-d "{ 'jsonrpc.servlet.name' : '/jsonrpc' }"
- Destroy the instance {inId}
curl -i -X DELETE http://localhost:8080/rose/machines/{mId}/instances/{inId}
- Get the InConnection linked to the machine {mId}
curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines/{mId}/ins
- Get the description of the InConnection {inId}
curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines/{mId}/ins/{inId}
- Create the InConnection named {inId} with the service_filter {filter}
curl -i -X PUT http://localhost:8080/rose/machines/{mId}/ins/{inId}?service_filter={filter}
you can set the protocol
...?protocol={protocol}
and some optional properties as content
-d "{ 'key' : 'value' }"
- Destroy the InConnection {inId}
curl -i -X DELETE http://localhost:8080/rose/machines/{mId}/ins/{inId}
- Get the OutConnection linked to the machine {mId}
curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines/{mId}/outs
- Get the description of the OutConnection {outId}
curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines/{mId}/outs/{outId}
- Create the OutConnection named {outId} with the service_filter {filter}
curl -i -X PUT http://localhost:8080/rose/machines/{mId}/outs/{outId}?endpoint_filter={filter}
you can set the protocol
...?protocol={protocol}
and some optional properties as content
-d "{ 'key' : 'value' }"
- Destroy the OutConnection {outId}
curl -i -X DELETE http://localhost:8080/rose/machines/{mId}/outs/{outId}
## API