Public Data API
The public data API module exposes parts of the normal API without authentication. The data is filtered and made available using Metadata on the original installations, functions and devices.
Paths
The API paths exposed in the Public Data API mirror those of the platform in structure, parameters and responses. The middleware here will expose a subset of information fetched from the original API endpoints. It is only possible to do GET requests to this API.
All public data endpoints are prepended with the word public like so: /public/<original-path>.
| Exposed paths |
|---|
/public/api/v2/installation |
/public/api/v2/installation/<installation_id> |
/public/api/v2/functionx/<installation_id> |
/public/api/v2/functionx/<installation_id>/<function_id> |
/public/api/v2/devicex/<installation_id> |
/public/api/v2/devicex/<installation_id>/<device_id> |
/public/api/v2/status/<installation_id> |
/public/api/v3/log/<installation_id> |
/public/api/v3beta/log/<installation_id> |
Mark object as public information
Metadata is used on all objects to mark them as exposed in the Public Data API. The key public needs to be set to true/1 on objects being exposed. The API response will be 404 when an ID for a non-exported object is used. It is important to always expose the installation first for the functions/devices/log/status to work correctly.
Override exposed meta-values
It is possible to override metadata parameters on the exposed object using overrides in metadata. This makes it possible to expose an object with a different name or with a different type when accessed as public data, and to hide private information in the object metadata.
Overrides of metadata use the same meta-key prepended with the public. prefix.
Example:
| Original | Override |
|---|---|
name = My house temperature | public.name = Stockholm temperature |
location = Some secret place | public.location = Outside |
It is also possible to override the type used in the public data API using the key public.type.