Introduction

Since the broker communicates with the outside world using a REST api interface there are many ways to interact with the server, either via command line (for example curl requests) or inside an application (for example with the python requests library). For someone that is just starting with the NGSI-LD api, it is quite a hustle having to manually search the available commands torwards the server and what they do. There is an existing NGSI-LD api swagger interface available online which had a few mistakes here and their which made the swagger interface unusable and uninteractive. I created a modified version of this interface that seems to be working properly (good enough to test various server interactions), the link of this interface is:

https://gitlab.isl.ics.forth.gr/ds-forth/ngsi-tools/-/tree/master/ngsi-ld-functional-swagger-interface.

(Also available in the useful tools / tab)

In order to have a backup in case the link to the repo above isn't working a copy is also provided bellow, it might not be the latest edited version so beware and prefer the gitlab version:

ngsild-swaggerinterface.yaml


<aside> ⚠️ While the details of how to have a self hosted swagger interface is still valid note that a working browser ready solution can be found at:

</aside>

https://app.swaggerhub.com/apis/SmartCityBus/ngsi-ld-api-modified/latest

<aside> ⚠️ Warning: Avoid using the server that is pre-registered in the file in the link except for SmartCityBus Project testing purposes! Please change the address to point at your server accordingly.

</aside>


If you are familiar with openapi and swagger, feel free to modify anything you see fit, and to notify me of any mistakes or inconsistencies.

Quick note that there is something with the CORS settings of chrome that blocked the messages to the server, I personally use chrome with the security settings disabled.

The command I use (Linux) is:

google-chrome --user-data-dir=”/var/tmp/Chrome” --disable-web-security

Windows: chrome.exe --disable-web-security --user-data-dir , Mac: open -a Google\ Chrome --args --disable-web-security --user-data-dir

Since you will probably want to run the interface locally, you should also install and run a swagger ui instance.

You can pull a pre-built docker image of the swagger-ui directly from Docker Hub:

docker pull swaggerapi/swagger-ui 
docker run -p 80:8080 swaggerapi/swagger-ui