Start with either the /assets or /locations endpoints, then use this API to retrieve the websocket URL to subscribe to “vehicle in, vehicle out” events.
The websocket URL provides a link to near real-time data for vehicle parking at the specified monitored location. You must use a websocket client to retrieve this data.
| METHOD | GET |
| URI | <production url>/v1/assets/{id}/live-events?event-types=PKIN, PKOUT |
| Sample Request URI | <production url>/v1/assets/1000000018/live-events?event-types=PKIN, PKOUT |
| Parameter | Description | Required? | Filter Values |
|---|---|---|---|
| id | GE identifier for the device. | Yes | Value such as 1000000018. |
| live-events | Specific to real-time data from websocket. | Yes | event-type |
| event-type | Filter for parking events. | Yes | Insert the following enumeration codes to identify vehicles entering and exiting parking spaces:
|
{
"url": "ws://ie-websocket-server-<production_url>/consume?routing_key=c358a630-592d-4257-93c8-bc1669fbf4c9",
"registered-events": "PKIN,PKOUT"
}
The Vehicle In, Vehicle Out API uses the WebSocket protocol for streaming data. The streaming endpoint format is: ws://<streaming url>
The WebSocket protocol is used instead of HTTP because Vehicle In, Vehicle Out streams near real-time data.
For all streaming requests, use the token you received from UAA in the Authorization section of the HTTP header, in the following format:
Bearer <token from trusted issuer>URL: wss://ingestion_url
Headers:
Authorization: Bearer <token from trusted issuer>
Predix-Zone-Id: <Predix-Zone-Id>
Origin: http://<origin-hostname>/
Request Payload: {
"messageId": "<MessageID>",
"body":
[
{
"name":"<TagName>",
"datapoints":
[
[
<EpochInMs>,
<Measure>,
<Quality>
]
],
"attributes":
{
"<AttributeKey>":"<AttributeValue>",
"<AttributeKey2>":"<AttributeValue2>"
}
}
]
}
| Parameter | Data Type | Required? | Description |
|---|---|---|---|
| event-uid | String | A unique identifier established by a customer or external resource for the parking event. | |
| timestamp | Number | Actual timestamp when event occurred. Timestamps are in EPOCH format. | |
| event-type | String | Identifies this type of event:
|
|
| device-uid | String | A unique identifier established by a customer or external resource for the device recording this event. | |
| location-uid | String | A unique identifier established by a customer or external resource to identify a parking location the vehicle entered or departed from in this event. | |
| properties | Map | Custom properties captured for this event-type instance. | |
| object-uid | String | A unique identifier established by a customer or external resource for the vehicle that entered or departed the related (parking) location. | |
| coordinates | Array | GPS coordinates identifying the location of the parked vehicle. Four coordinates representing the vehicle should be provided for each location-uid. | |
| measures | Array |
|
{
"event-uid": "360597e9-3a3d-4f1c-a686-4d575ba11f55",
"timestamp": 1461019279795,
"event-type": "PKOUT",
"device-uid": "HYP1040-75",
"location-uid": "158-parkingspot",
"properties": {
"object-uid": "cf0dfb91-b11e-4d4d-9213-eb057187122f",
"coordinates":
"32.711637:-117.15732968838816,32.711637100678395:-117.15736341303291,32.711734:-117.15736427535526,32.711733:-117.15733055071051"
},
"measures": [
{
"tag": "PKOVLP",
"value": 100,
"unit": "PCT"
}
]}