Get Pedestrian Data API

Start with either the /assets or /locations endpoints, then use this API to retrieve the WebSocket URL to subscribe to “pedestrian in, pedestrian out” events.

The websocket URL provides a link to near real-time data for pedestrians 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=SFIN, SFOUT
Sample Request URI <production url>/v1/assets/1000000027/live-events?event-types=SFIN, SFOUT

Query Parameters

Parameter Description Required? Filter Values
id GE identifier for the device. Yes Value such as 1000000027.
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:
SFIN
If you filter by SFIN, you receive a list of pedestrians (identified by object-id) entering monitored areas within the boundaries.
SFOUT
If you filter by SFOUT, you receive a list of pedestrians (identified by object-id) exiting monitored areas within the boundaries.

Sample Response

This API returns a WebSocket response. You must use a WebSocket client to retrieve the live data.
{
  "url": "ws://intel-env.websocket-server-dev.run.aws-usw02-pr.ice.predix.io/consume?routing_key=26fb7ac1-036a-46e1-9716-5c047c13a89b",
  "registered-events": "SFIN,SFOUT"
}

WebSocket Information

The Vehicle In, Vehicle Out API uses the WebSocket protocol for streaming data in the following endpoint format: ws://<streaming url>

The WebSocket protocol is used instead of HTTP because Pedestrian Data streams near real-time data.

Note: The ingestion URI and <Predix-Zone-Id> are included with the environment variables for your application when you bind your application to Intelligent Environment services instance. To view the environment variables, on a command line, enter:
cf env <application name>

For all streaming requests, use the token received from UAA in the Authorization section of the HTTP header in the following format:

Bearer <token from trusted issuer>
The following example shows a data-ingestion request:
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>"
          }
       }
    ]
 }

WebSocket Response Parameters

Parameter Data Type Required? Description
event-uid String   A unique identifier established by a customer or external resource for the pedestrian event.
timestamp Number   Actual timestamp when event occurred. Timestamps are in EPOCH format.
event-type String   Identifies this type of event:
SFIN
Pedestrian (identified by object-id) entering monitored area within the boundaries.
SFOUT
Pedestrian (identified by object-id) exiting monitored area within the boundaries.
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 for the monitored location for pedestrian entry and exit.
properties Map   Custom properties capture for this event-type instance.
object-uid String   A unique identifier established by a customer or external resource for the pedestrian that entered or departed the related location (such as crosswalk).
coordinates Array   GPS coordinates identifying the location. Four coordinates should be provided for each location-uid.
measures Array  
tag
identifier for the pedestrian
value
number, such as 100

Sample Response

Note: You must use a WebSocket client to retrieve this data.
{ 
        "event-uid": "f9094290-fdf1-4e47-b4db-9cb0bd0db0e5", 
        "timestamp": 1461017947527, 
        "event-type": "SFIN", 
        "device-uid": "1345-1212", 
        "location-uid": "1345-crosswalk", 
        "measures": [   
        {     
        "tag": "SFCNT",     
        "value": 8   
        } 
        ]}