RestApi

Submitted by gpulido on 2011, December 1 - 15:49
5
Average: 5 (1 vote)
RestApi
Driver
Development Status: 
Beta Version
Developer: 
gpulido
Tested on: 
Linux
Windows
Download Link: 
Download Link: 
Download Link: 
Short Description: 

Restfull Api to Freedomotic. This plugin is needed to exchange Freedomotic data like environment topology and related objects with external clients.

This plugin enables Freedomotic to expose part of it data as a RESTFull representation in a web server, this way any Client that wants to intercomunicate with Freedomotic is capable of retrieve the same data that is used in the core.

The plugin starts a little web server in the machine in wich is running.

URL Mapping

Version 5.5

IMPORTANT: on version 5.5 the api has changed. If you are still using the version 5.4 Please go to the 5.4 section

 

The resources are accesible throught url in the web server, the root url of all resources is the following:

http://xxx.xxx.xxx.xxx:8111/v2 where xxx.xxx.xxx.xxx is the IP address of the machine in wich the restapi is running.

In the following table is resumed the resources specific url part that must be attached to the root to be capable of retrieve each resource:

 

urlParameterREST METHODSFreedomotic Java ObjectXML

/environments/

N/AGETArrayList<Enviroment>XStream conversion

/environments/{env}

env: numeric index of the env to retrieve

GETEnviromentXStream conversion
/environments/{env}/zones/env: numeric index of the env to retrieveGETArrayList<Zone>Xstream Conversion
/environments/{env}/zones/{index}

env: numeric index of the env to retrieve

index: numeric index of the zone to retrieve

GETZoneXstream Conversion
/objects/N/AGETArrayList<EnvObject>Xstream Conversion
/objects/{name}

name: text the name of the object to retrieve

GETEnvObjectXstream Conversion
/plugins/N/AGETN/AXstream Conversion
/commands/hardware/N/AGETN/AXstream Conversion
/commands/user/N/AGETN/AXstream Conversion
/triggers/N/AGETN/A

Xstream Conversion

/resources/{filename}The name of the FileGETN/AN/A

NOTE: The values betwen {} are parameters that should be changed by the correct value

For example, if the RestApi is running in a machine with an IP:192.168.1.20 to retrieve the object xml representation with name: "TV" we should use the following url:

http://192.168.1.20:8111/v2/objects/TV

We could test the RestApi using any rest client, for example a web browser like Chrome or Firefox.

Also in the path /resources/{filename} are served as static files all resources in the freedom resources directory.

Version 5.4

The resources are accesible throught url in the web server, the root url of all resources is the following:

http://xxx.xxx.xxx.xxx:8111/v1 where xxx.xxx.xxx.xxx is the IP address of the machine in wich the restapi is running.

In the following table is resumed the resources specific url part that must be attached to the root to be capable of retrieve each resource:

 

urlParameterREST METHODSFreedomotic Java ObjectXML
/environment/N/AGETEnviromentXStream conversion
/environment/zones/N/AGETArrayList<Zone>Xstream Conversion
/environment/zones/{index}index: numeric index of the zone to retrieveGETZoneXstream Conversion
/environment/objects/N/AGETArrayList<EnvObject>Xstream Conversion
/environment/objects/{name}

name: text the name of the object to retrieve

GETEnvObjectXstream Conversion
/environment/plugins/N/AGETN/AXstream Conversion 
/environment/commands/hardware/N/AGETN/AXstream Conversion
/environment/commands/user/N/AGETN/AXstream Conversion
/environment/triggers/N/AGETN/A

Xstream Conversion

/resources/{filename}The name of the FileGETN/AN/A

NOTE: The values betwen {} are parameters that should be changed by the correct value

For example, if the RestApi is running in a machine with an IP:192.168.1.20 to retrieve the object xml representation with name: "TV" we should use the following url:

http://192.168.1.20:8111/v1/environment/objects/TV

We could test the RestApi using any rest client, for example a web browser like Chrome or Firefox.

Also in the path /resources/{filename} are served as static files all resources in the freedom resources directory.

Freedomotic Domotica Open Source Building and Home Automation Drupal theme by Kiwi Themes.