CKAN extension that will give you the ability to generate real-time resources provided by a Context broker. Some resources may need your IDM token, so you must be logged in to be able to see those resources properly.
Note: This extension has been tested in CKAN 2.2 and 2.3. It may not work in other versions.
- OAuth2 CKAN Extension. OAuth2 CKAN Extension. This extension might be needed since some the requests sent to the ContextBroker must include the OAuth2 credentials to identify the user that is creating the offering.
Install this extension in your CKAN is instance is as easy as install any other CKAN extension.
- Download the source from this GitHub repo.
- Activate your virtual environment (generally by running
. /usr/lib/ckan/default/bin/activate
) - Install the extension by running
python setup.py develop
- Modify your configuration file (generally in
/etc/ckan/default/production.ini
) and addngsiview
to theckan.plugins
and to ckan.views.default_views. - Restart your apache server (
sudo service apache2 restart
)
The way to create a NGSI resource is fairly simple:
-
Firstly you have to access to the resource create section and choose the option Link.
-
Fill the URL field with a Context Broker query, if your query is a convenience operation, you only have to fill the URL field with it. If instead, it is a standard operation query, you have to do an additional step after create the resource in order to add a payload to de query. You can control the results pagination at the same way that in a common Context Broker query.
-
Complete the Format field with ngsi9 or ngsi10 and click on add resource. This is an important step, and without it the extension won’t do anything with your resource.
-
Finally set the OAuth-token field to required if you are working with Orion ContextBroker at http://orion.lab.fiware.org:1026. Additionally you can also manage the tenant and the service path as the same way that it is explained at Orion Context Broker documentation.
If your query is a convenience type, your resource has already been created, on the contrary if it is a standard operation you have to do the next step.
-
Standard operations only: Click on manage to edit your resource, now an additional field has appeared, complete it with a payload and click on update to save your query payload.
Ckanext-ngsiview is being adapted to allow to load and preview of historic data provided by STH, the new format associated to that kind of resources is named as ngsi-h.
By now there isn't a stable version of STH, and its API may be modified, but the intention is to keep the same structure and data creation process that an standard ngsi resource.