This accessor discovers REST services on the web and and generates a concrete REST accessor for the service. It requires the contextAware module and interface definition of concrete REST services. Please see: https://www.icyphy.org/accessors/wiki/Version0/ContextAware
Example usage of ContextAware accessor:
This accessor generalizes the capability of REST.js by providing a simple interface for a user to select a concrete REST service and provides the context (set of inputs needed) to invoke that concrete REST service and set of outputs needed from the service.
Currently it is coded for three concrete REST services (GSN, Firebase, and Paraimpu), but can be expanded to any number of REST services as long as the interface of the service can be defined. The three services that this accessor works with are the GSN, which is a global sensor network server hosted in Texas State university, the Paraimpu which is a social aware middleware for Internet of Things and Firebase which is a cloud service from Google that provides storage for IoT.
This is just an experimental system, so the UI is very primitive and basic. To experiment with it, do the following:
- double click on the accessor, make a selection, press commit,
- double click on the accessor, press the reload button and then press commit,
- double click again and the required input for the selected REST service will appear on the editor menu
- for GSN, enter 'pluto.cs.txstate.edu' for the host, enter '22001' for the port, select the specific output dataType or leave it as "all". Leave the rest as default
- for Paraimpu, enter 'api.paraimpu.com' for the host, enter '443' for the
port, enter this
46e0ee55195c4dd9dca295a7ac8282d28f4a2259for access token. Select the dataType for output or leave it as 'all'
- for Firebase, enter 'sizzling-fire-8605.firebaseio.com' for the host, enter '443' for port, leave the rest as default. Select the appropriate dataType to output or leave it as 'all'.
||number||to the accessor|
Filter the response. It overrides the filterResponse() in the base class to extract a portion of the response that is defined in the corresponding service interface
Upon receiving details of a REST service, construct a concrete REST accessor to access the service.
Define the input and the choice of REST services to which this accessor may adapt.
Filter the response from Firebase. Extracting data about microwave, its last reading and current status
Filter response from GSN. The response is in xml format which needs to be converted first to json. Then extract data about the Phidget sound sensor. A more generic way to extract the sensor data is needed in the future so that there is no need to change this extraction logic when a different sensor data is needed from this source