Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
bin
controllers
lib
public
routes
views
.eslintignore
.eslintrc
.npmignore
README.md
app.js
iot.js
package.json

README.md

This is a simple Node.js express application which offers an NGSI v1 proxy interface to four context providers.

QueryContext Endpoints

The following NGSI v1 endpoints are supported

  • /random/<type>/<mapping>/queryContext. returns random data values of "type": "<type>" - e.g. /random/text/quote/queryContext will return random lorem ipsum

  • /static/<type>/<mapping>/queryContext returns static data values of "type": "<type>" - e.g. /static/text/quote/queryContext will return "I never could get the hang of thursdays"

  • /twitter/<type>/<mapping><queryString>/<attr>/queryContext Work in progress

  • /weather/<type>/<mapping>/<queryString>/<attr>/queryContext Retrieves the Weather data for the queryString location and maps the data from the given attr to the entity response.

    For Example /proxy/weather/number/berlin%2cde/wind_speed/queryContext will read the wind_speed value from Berlin. and /proxy/weather/number/cairo%2ceg/temp/queryContext will read the temp value from Cairo.

Mappings

NGSI attribute names should follow Data Model Guidelines (e.g. camelCasing) Data returned from third-party APIs will not enforce the same guidelines. It is therefore necessary to invoke a mapping to be able to know which values to retieve.

The mapping path element is assumes that mappings are defined in the path as follows:

  • temperature
    • temperature NGSI attribute maps to temperature attribute on the API data
  • temperature:temp
    • temperature NGSI attribute maps to temp attribute on the API data
  • temperature:temp,windSpeed:wind_speed
    • temperature NGSI attribute maps to temp attribute on the API data
    • windSpeed NGSI attribute maps to wind_speed attribute on the API data

For the full guidelines see the FIWARE Data Models

Health Check Endpoints

The following health check endpoints are supported:

  • /random/health A non-error response shows that an NGSI proxy is available on the network and returning values. Each Request will return some random dummy data.

  • /static/health A non-error response shows that an NGSI proxy is available on the network and returning values. Each Request will return the same data.

  • /twitter/health A non-error response shows that an NGSI proxy for the Twitter API is available on the network and returning values.

    If the proxy is correctly configured to connect to the Twitter API, a series of Tweets will be returned.

    The Twitter API uses OAuth2:

  • /weather/health A non-error response shows that an NGSI proxy for the Weather API is available on the network and returning values.

    If the proxy is correctly configured to connect to the Open Weather Map API, the current weather in Berlin will be returned.

    Most of the Weather API features require an API key.

Keys and Secrets

All Keys and Secrets must be passed in using Environment variables. The following variables must be provided

  • OPENWEATHERMAP_KEY_ID=<ADD_YOUR_KEY_ID>
  • TWITTER_CONSUMER_KEY=<ADD_YOUR_CONSUMER_KEY>
  • TWITTER_CONSUMER_SECRET=<ADD_YOUR_CONSUMER_SECRET>

License

MIT © 2018 FIWARE Foundation e.V.

See the LICENSE file in the root of this project for license details.

The Program includes additional icons downloaded from www.flaticon.com which were obtained under license:

You can’t perform that action at this time.