The REST Api allows you to create and configure RoSe Machine through HTTP.

Install

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>

Overview

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

Usage

The following section show you how to use the API with curl.

Machines

  • Get the ids of the RoSe machine created through this API: bash curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines

  • Get the description of the machine :id bash curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines/:id

  • Create a new machine :id bash curl -i -X POST -d '{ "id" : ":id" }' http://localhost:8080/rose/machines you can also set the hostname :hostname bash -d '{ "id" : ":id", "host" : ":hostname"}'

  • Destroy the machine {id}: bash curl -i -X DELETE http://localhost:8080/rose/machines/{id}

Instances

  • Get the instances linked to the machine {mId} bash curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines/{mId}/instances

  • Get the description of the instance {inId} bash 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} bash curl -i -X PUT http://localhost:8080/rose/machines/{mId}/instances/{inId}?component={component} you can set some optional properties (as content) bash -d "{ 'jsonrpc.servlet.name' : '/jsonrpc' }"

  • Destroy the instance {inId} bash curl -i -X DELETE http://localhost:8080/rose/machines/{mId}/instances/{inId}

In Connections

  • Get the InConnection linked to the machine {mId} bash curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines/{mId}/ins

  • Get the description of the InConnection {inId} bash 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} bash curl -i -X PUT http://localhost:8080/rose/machines/{mId}/ins/{inId}?service_filter={filter} you can set the protocol bash ...?protocol={protocol} and some optional properties as content bash -d "{ 'key' : 'value' }"

  • Destroy the InConnection {inId} bash curl -i -X DELETE http://localhost:8080/rose/machines/{mId}/ins/{inId}

Out Connections

  • Get the OutConnection linked to the machine {mId} bash curl -i -H "Accept: application/json" -X GET http://localhost:8080/rose/machines/{mId}/outs

  • Get the description of the OutConnection {outId} bash 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} bash curl -i -X PUT http://localhost:8080/rose/machines/{mId}/outs/{outId}?endpoint_filter={filter} you can set the protocol bash ...?protocol={protocol} and some optional properties as content bash -d "{ 'key' : 'value' }"

  • Destroy the OutConnection {outId} bash curl -i -X DELETE http://localhost:8080/rose/machines/{mId}/outs/{outId}