Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
bin Restructure source code for Context-Provider Oct 31, 2018
controllers Fix that the staticValueForType and randomValueForType function the r… Jan 16, 2019
lib Adding Administrating XACML via a PAP Tutorial Jan 11, 2019
public Restructure source code for Context-Provider Oct 31, 2018
routes Move NGSI proxies to subfolder Dec 20, 2018
views Alert user if access denied. Jan 11, 2019
.eslintignore
.eslintrc Restructure source code for Context-Provider Oct 31, 2018
.npmignore Restructure source code for Context-Provider Oct 31, 2018
README.md Updating text linting rules and scope Nov 1, 2018
app.js Re-prettifying based on latest ruleset. Nov 1, 2018
iot.js Re-prettifying based on latest ruleset. Nov 1, 2018
package-lock.json Linting Markdown Feb 4, 2019
package.json Improving text and amending links. Feb 4, 2019

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: