Standards

Using the Intelligent Environment APIs WebSocket and REST services

As defined by the query parameters, Intelligent Environments APIs use “live” functions to request and receive near real-time event data using a secured WebSocket protocol, and “filter” functions to retrieve event data using HTTPS.

For available query parameter details, see the General APIs Overview - Cities section in this document.

Note: You need to send the bearer token and Predix-Zone-Id while establishing the Websocket connection.
To retrieve near real-time events, use the Websocket protocol instead of HTTPS for streaming data. The streaming endpoint is:
"wss://<streaming url>

Example:

Options for using Receive Events (PUSH):

Websocket URL: wss://<production url>/events

  • By AssetUID

    Headers:

    Authorization: Bearer <token from trusted issuer> Predix-Zone-Id: <Predix-Zone-Id> 

    Request Payload:

    {
    	"assetUid": "<assetUID>",
    	"eventTypes": ["<eventType1>","<eventType2>"]
    }
    
  • By Location

    Headers:

    Authorization: Bearer <token from trusted issuer> Predix-Zone-Id: <Predix-Zone-Id>

    Request Payload:

    {
    	"bbox": "<latitude1>:<longitude1>,<latitude2>:<longitude2>",
    	"eventTypes": ["<eventType1>","<eventType2>"]
    }
  • By LocationUid

    Headers:

    Authorization: Bearer <token from trusted issuer> Predix-Zone-Id: <Predix-Zone-Id>

    Request Payload:

    {
    	"locationUid": "<location-UID>",
    	"eventTypes": ["<eventType1>","< eventType2>"]
    }

Options for using Retrieve Events (PULL):

  • By AssetUid
    https://{{eventurl}}/v2/metadata/assets/<assetUid>/events?eventTypes=<event-type>&startTime=<EPOCH_Timestamp>&endTime=<EPOCH_Timestamp> 
  • By Locations
    https://{{eventurl}}/v2/metadata/locations/events?bbox=""&eventType=<String>&locationType=<String>&starttime=<EPOCH_Timestamp>&endtime=<EPOCH_Timestamp>
  • By LocationUid
    https://{{eventurl}}/v2/metadata/locations/{locationUid}/events?eventType=<String>&startTime=<EPOCH_Timestamp>&endtime=<EPOCH_Timestamp>