Skip to content

This is an Spring Boot based adapter, that will take data from smart parking and forwards it to Wolfsburg's open data platform.

License

Notifications You must be signed in to change notification settings

starwit/odp-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Data Platform Adapter

This software implements an adapter to Wolfsburg's open data platform. It will update available parking spots for configured parking space.

Functions

Adapter implements the following functions:

  • Get OffStreetParking status
  • Set OffStreetParking status

Configuration

App can be configured via application.properties file. Just on parking area is supported and it's configuration is also done via application properties. Next to all Spring Boot config the following keys can be used:

# base path for api
rest.base-path=api
# if true update starts immediately
config.autostart=true

# user name for ODP login
odp.auth.username=meckauer 
# password for ODP login
odp.auth.password=secret 
# URL to get auth token
odp.auth.url=https://auth.staging.wolfsburg.digital/auth/realms/default/protocol/openid-connect/token

# URL to read & update parking space data
odp.parking.url=https://api.staging.wolfsburg.digital/context/v2/entities/

# How often updates will be send
odp.update_frequency=30000

# Configure mapping to parking area
odp.parkingareaid=OnStreetParking:38444039
# fallback default, if reading value from ODP fails
odp.parkingareaid.defaulttotal=70
# prefix for observation areas to sum
analytics.observation_area_prefix=parking

Build & Run

Adapter is build as a Spring Boot application, that runs an update job with a fixed schedule. Building and running can be done like so:

    mvn clean package
    java -jar run target/odp-adapter-1.0-SNAPSHOT.jar

Background Wolfsburg's Open Data Platform

Wolfsburg's open data platform follows the Fiware standard and here is some background doc, how this platform can be used.

Get access token:

curl -H application/x-www-form-urlencoded -d "realm=default" -d "client_id=api" -d "scope=entity:read entity:write" -d "username=username" -d "password=PASSWORD" -d "grant_type=password" "https://auth.staging.wolfsburg.digital/auth/realms/default/protocol/openid-connect/token"

Get latest OffStreetParking data

curl --location 'https://api.staging.wolfsburg.digital/context/v2/entities/OnStreetParking:38444039/' -H 'fiware-ServicePath: /ParkingManagement' -H 'fiware-service: Wolfsburg' -H 'Authorization: Bearer TOKEN'

Update OffStreetParking data

curl --location --request PATCH 'https://api.staging.wolfsburg.digital/context/v2/entities/OnStreetParking:38444039/attrs/' \
--header 'fiware-ServicePath: /ParkingManagement' \
--header 'fiware-service: Wolfsburg' \
--header 'content-type: application/json' \
 -H 'Authorization: Bearer Token ' \
--data '{
    "availableSpotNumber": {
        "type": "Integer",
        "value": 55
    }
}'

Query ParkingSpots

curl --location 'https://api.staging.wolfsburg.digital/context/v2/entities?type=ParkingSpot' -H 'fiware-ServicePath: /ParkingManagement/Meckauer' -H 'fiware-service: Wolfsburg' -H 'Authorization: Bearer TOKEN'

License & Contribution

This software is published under the AGPLv3 and the license agreement can be found here. Pull requests are very much appreciated and you contributed code will be licensed as AGPLv3 as well.

About

This is an Spring Boot based adapter, that will take data from smart parking and forwards it to Wolfsburg's open data platform.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •