Core Data Service APIs

The Core Data microservice provides a centralized persistence facility for data readings collected by devices and sensors.

Content

  • Core Data's purpose

  • Event & Reading

  • REST API outline

  • Reference

Core Data’s Purpose

  • Provides a centralized persistence facility for data readings collected by devices and sensors.

  • Device services for devices and sensors that collect data, call on Core Data to store the device and sensor data on the edge system (such as a gateway)

    • Allows for store and forward technology

    • Supports actuation decisions at the edge

  • Data is stored until…

    • It can be moved "north" and exported to Enterprise and cloud systems

    • It is “scrubbed” to make way for new sensor data

  • Provides an API that other services can use to access the historical data

    • Should be used sparingly as not to impact data collection

Event & Reading

  • Events are collections of Readings

    • Associated to a device

  • Readings represent a sensing on the part of a device/sensor

    • Simple Key/Value pair

    • Key is a value descriptor

    • Value is the sensed value

    • Ex: Temperature: 72

  • Event would need to have one Reading to make sense

REST API Outline

  • Event APIs

    • DELETE – should really only be used by data clean up facilities

    • GET’s galore to query for Events, by

      • id

      • Associated Device

      • timestamp (range start & end)

      • Associated Device and Reading with particular Value Descriptor

    • GET Event count

  • Reading APIs

    • GET’s galore to query for Readings, by

      • id

      • Associated Device (via Event)

      • uomLabel (of associated Value Descriptor)

      • label (of associated Value Descriptor)

      • type (of associated Value Descriptor)

      • Timestamp (via Event)

    • GET Reading count (good debug/checking mechanism)

Some API examples

GET Event Count

http://localhost:48080/api/v1/event/count/{deviceId}

Return a count of the number of events in core data for a given device - identified by id or name.

GET Events

http://localhost:48080/api/v1/event/device/{deviceId}/{limit}

Return list of events with their associated readings for a given device, sort by event creation date.

DELETE Events by deviceId

http://localhost:48080/api/v1/event/device/{deviceId}

Delete all events (and their readings) associated to a device given the device's id (either database generated id or name).

DELETE All Events

http://localhost:48080/api/v1/event/scrub

Remove all pushed events and their associated readings.

GET Reading by device

http://localhost:48080/api/v1/reading/device/{deviceId}/{limit}

Return list of all readings for a given device, sort by reading creation date.

GET Reading by value descriptor and device

http://localhost:48080/api/v1/reading/name/{name}/device/{deviceId}/{limit}

Return a list of readings that are associated to a ValueDescripter by name and Device by name (or id).

Reference

Core-data API document link: https://docs.edgexfoundry.org/core-data.html

Last updated