This is a collection of tutorials for the FIWARE ecosystem designed for NGSI-LD developers. Each tutorial consists of a series of exercises to demonstrate the correct use of individual FIWARE components and shows the flow of context data within a simple Smart Solution either by connecting to a series of dummy IoT devices or manipulating the context directly or programmatically.
📚 NGSI-LD Documentation |
Postman Collections |
|
developer.fiware.org |
---|
Note
Should I use NGSI-LD or NGSI-v2?
FIWARE offers two flavours of the NGSI interfaces:
- NGSI-v2 offers JSON based interoperability used in individual Smart Systems
- NGSI-LD offers JSON-LD based interoperability used for Federations and Data Spaces
Of the two, NGSI-LD is more complex and relies on the introduction of a JSON-LD @context
.
A full understanding of JSON-LD (Linked Data) is required to obtain the benefits of NGSI-LD ,
which allows for interoperability across apps and organisations.
In general, you should use NGSI-LD when creating a data space or introducing a system of systems aproach.
Use NGSI-v2 for simpler isolated systems. More information about NGSI-v2 can be found here
The tutorials define a series of data-models to be used within the @context
. More information about the classes and
attributes used can be found in the following:
To download the full set of tutorials, simply clone this repository:
git clone https://github.com/FIWARE/tutorials.NGSI-LD.git
cd tutorials.NGSI-LD/
git submodule update --init --recursive
The OpenAPI Specification (commonly known as Swagger) is an API description format for REST APIs. A Swagger spec allows you to describe an entire API (such as NGSI-LD itself) however in this tutorial we shall be concentrating on using Swagger to define data models.
API specifications can be written in YAML or JSON. The format is easy to learn and readable to both humans and machines.
The complete OpenAPI Specification can be found on GitHub:
OpenAPI 3.0 Specification. This is
important since we will need a well-defined structure to be able to generate @context
files.
The NGSI-LD tutorials are designed to run under any Unix environment, the tested configuration and GitPod environment is currently based on Ubuntu 22.04.2 LTS. However, there may be some minor issues when running the tutorials directly on Windows machines or Apple M1 Silicon amd64 systems, and the following Virtual Box set-up or WSL set-up can be used when facing issues.
Each tutorial runs all components using Docker. Docker is a container technology which allows to different components isolated into their respective environments.
- To install Docker on Windows follow the instructions here.
- To install Docker on Mac follow the instructions here.
- To install Docker on Linux follow the instructions here.
Docker Compose is a tool for defining and running multi-container Docker applications. A series of *.yaml
files
are used configure the required services for the application. This means all container services can be brought up in a
single command. Docker Compose is installed by default as part of Docker for Windows and Docker for Mac, however Linux
users will need to follow the instructions found here.
You can check your current Docker and Docker Compose versions using the following commands:
docker-compose -v
docker version
Please ensure that you are using Docker version 20.10 or higher and Docker Compose 1.29 or higher and upgrade if necessary.
Although not officially supported, older versions of docker without an integrated docker-compose can be run by adding
legacy
to all bash script commands:
./services start legacy
The tutorials which use HTTP requests supply a collection for use with the Postman utility. Postman is a testing framework for REST APIs. The tool can be downloaded from www.postman.com. All the FIWARE Postman collections can be downloaded directly from the Postman API network.
Gitpod is an open-source Kubernetes application for ready-to-code cloud development environments that spins up an automated dev environment for each task, in the cloud. It enables you to run the tutorials in a cloud development environment directly from your browser or your Desktop IDE.
101. Understanding @context
102.
Working with @context
103.
CRUD Operations
104.
Concise Payloads
105.
Merge-Patch and Put
106.
Entity Relationships
107.
Subscriptions
108.
Temporal Operations
109.
Extended Properties
201. Introduction to IoT Sensors
202. Provisioning the Ultralight IoT Agent
203. Provisioning the JSON IoT Agent
304. Querying Time Series Data (QuantumLeap)
305. Big Data Analysis (Flink)
306. Big Data Analysis (Spark)
401. Managing Users and Organizations
402. Roles and Permissions
507. Cloud-Edge Computing
Most tutorials supply a services
script to start the containers:
cd <tutorial-name>
git checkout NGSI-LD
./services start
Each tutorial submodule contains one or more docker-compose.yml
files, along with a Postman collection containing the
necessary HTTP requests: import the collection into Postman and follow the instructions.
Each submodule contains full instructions in README which details the appropriate bash commands (cUrl and Docker Compose) to run.
Full instructions can be found within the documentation
MIT © 2020-2024 FIWARE Foundation e.V.