The Snap4City API: a tool for smart city developers

Author: Paolo Caressa, February 16, 2019

Originally published on: https://www.codemotion.com/magazine/the-snap4city-api-a-tool-for-smart-c...

Integrated platforms and frameworks are the standard solution to the development, test and deployment of applications within complex environments: for example, no one today would program from scratch a neural network while there are plenty of libraries, APIs and frameworks to do that according to different needs, programming paradigms, etc.

Smart city is one of the biggest arena for development and, as such, requires the mastering of too many assets (both services and infrastructures) to be done “from scratch”, or even to be done via a general purpose development framework. On the contrary, it is crucial for the success of smart city projects that suitable tools and very general and comprehensive frameworks are available to let the developers focus on the real target of their application.

As we know from previous articles (for example the in-depth article on sentient cities), Snap4City, an open, standardised, data-driven, service-oriented and user-centric platform aimed at developing IOT/IOE applications, allows for the creation of general applications via wizards and dashboards, in particular applications may be written or drawn in a graphical language where programming structures are connected both to devices and to dashboards, to be able to perform data analytics, to invoke external services, to execute machine learning algorithms, etc.
But for more specific and sophisticated purposes, Snap4City provides also a powerful set of APIs which can be profitably used to build applications and services of different kinds: the Smart City API.

https://about.codemotion.com/app/uploads/2019/02/caressa201.png

Img 1: Smart city API Web documentation page

The API is actually structured in several APIs, logically grouped according to the kind of services they offer: thereafter we will deal with some of those APIs which are of paramount interest when developing smart city applications.

The IOT Device Registration API, which can be used to register IOT devices to the IOT directory, a preliminary step before using them to collect data and interact with devices located in various part of the city.

 

https://about.codemotion.com/app/uploads/2019/02/caressa202.jpg
Img 2: Devices directory page

The Notificator API, which lets the application which uses it be informed about notifications, as they are defined inside the City Dashboard, a basic tool when using Snap4City.

https://about.codemotion.com/app/uploads/2019/02/caressa203.jpg
Img 3: Events in the notificator dashboard

The DISCES Scheduler API, aimed at monitoring and controlling back office processes of data ingestion and data analytics: DISCES (Distributed Smart City/Cloud Engine Scheduler), is a scheduler supporting Elastic Management, which allows us to collect the scheduling plans for various processes (e.g. ETL, Data Analytics), to create a plan for the execution of processes over time, to monitor the resources of the cloud (hosts, virtual machines, containers), to turn on/off hosts and to deploy and shutdown virtual machines and containers.

 

https://about.codemotion.com/app/uploads/2019/02/caressa204.png

Img 4: Back office scheduler DISCES

All the previous APIs are also available as IOT microservices block for IOT applications [link to my first document “article 3” if possible] to be arranged via the wizard GUI within the dashboard.

Moreover, Smart City APIs provide the Km4City Web App API, which provides services accessible as API REST and which may be viewed as actual “micro-applications” ready to be used, also directly from the dashboard or from other IOT applications.

The Resource Manager API can be used to save and search resources managed by the Resource Manager: they can be IOT Applications, ETL processes, Data Analytics Processes, Dashboard, etc. They can also be saved and retrieved from the API so that the other tools can use the Resource Manager API to showcase their instances, to share and promote their work.

https://about.codemotion.com/app/uploads/2019/02/caressa-205.png
Img 5: Resource Manager: an actual process loader

Also there is a Sensor API, which is designed to let mobile phone and other mobile devices communicate to the back office to signal their status, position and other relevant information. This API is also involved in collecting suggestions, hints, assistance, etc.

As a part of the Smart City API, Snap4City also provides a mobile development app kit, which is an open source example for developing mobile and web apps using Cordoba Apache.

Last but not least, it is worth mentioning the Advanced Smart City API, a useful container of APIs exporting various services among which we may list:

  • Search data: by text, near, along line, etc. resolving text to GPS and formal city nodes model, resolving from GPS to street civic number, etc.
  • Empowering the city users: collecting data from end users’ bidirectional data flow; votes, comments, images
  • Accessing to event information, provided that they are loaded into the storage by means of some ETL or NodeRED process
  • Accessing to info and services on Public Mobility: bus stops, public transport lines (bus, train, and ferry), public routes, public transport position, arrival time, etc.
  • Accessing to info and services on Private Mobility: routing, parking recovery
  • Accessing to Cultural and Touristic information.
  • Accessing to health services and environmental information.
  • Requesting routing: car, vehicle, multimodal exploiting pedestrian and public transport
  • Requesting suggestions and personal assistant hints, provided that an assistant is actually installed in the solution
  • Subscription/request of a Snap4City applications
  • Sharing knowledge among cities
  • Providing feedback about services
  • Discovering IOT devices

The Advanced Smart City API can be used to develop HTML5 and mobile apps.

Snap4City Hack

Snap4City platforms and solutions are available at Snap4city.org website, where you can register and start exploring its features. But if you want to really challenge your skills and propose your innovative solutions for connected cities, you can join the upcoming Snap4City Hack, the big online hackathon on the topics of Smart City and IoT.

Snap4City launched a big online Hackathon on Ecological Watch, Social and Service Evolution, Stimulating Business Growth, City Aware.

Using Snap4City tools to manage IoT, Big Data and analytics, the hackathon challenges will cover different themes – Ecological Watch, Social and Service Evolution, Stimulating Business Growth, City Aware – and real data from cities such as Helsinki or Antwerp.

Further information on the Hackathon is available on the on Snap4City.org/hackathon website.