Use Case

Add two detectors to a count location associated to a count site

The System Integrator (SI) creates a sensors network.

First step

In one only payload the SI can build the entire hierarchy of count sites, count locations and detectors.

In this use case, in the same payload are specified:

  • A count site, characterized by: type, name, location code and location shape.
  • A count location associated to the count site, characterized by: name, device code and location shape.
  • Two distinct detectors, associated to the count location, characterized by: name, code, and detector location.

The endpoint is:

POST
https://api.ptvgroup.tech/dataprovider/v1/api/public/detectors/count-site

 

Path parameter 

Not applicable.

Query parameters 

No query parameters are needed.

Example of request

https://api.ptvgroup.tech/dataprovider/v1/api/public/detectors/count-site

Host: api.ptvgroup.tech

Authorization: apiKey YOUR_API_KEY

Accept: application/json

Example of payload

{
 "countSites": [
   {
     "countSiteType": "SENSOR_SITE",
     "name": "Count_Site_1",
     "siteLocation": {
       "code": "D-1001",
       "shape": "POLYGON((13.4040 52.5190, 13.4060 52.5190, 13.4060 52.5210, 13.4040 52.5210, 13.4040 52.5190))"
     },
     "countDevices": [
       {
         "code": "CD-1001",
         "countSiteCode": "CS-1001",
         "name": "Count_Device_1",
         "hardwareId": "HW-56789",
         "deviceLocation": {
           "hardwarePosition": "POINT(13.4050 52.5200)",
           "heading": 90,
           "shape": "POLYGON((13.4040 52.5190, 13.4060 52.5190, 13.4060 52.5210, 13.4040 52.5210, 13.4040 52.5190))"
         },
         "isActive": true,
         "detectors": [
           {
             "countDeviceCode": "CD-1001",
             "code": "DET-1001",
             "name": "Traffic-DET",
             "detectorLocation": {
               "shape": "POINT(13.4050 52.5200)",
               "heading": 90,
               "mapModelEntity": {
                 "entityId": "120020",
                 "entityType": "LINK",
                 "linkShapePercentFromNodeId": 0.5
               }
             },
             "allowedMeasures": [
               {
                 "measureTypeCode": "SPEED",
                 "detectedVehicleTypeCodes": [
                   "CAR",
                   "BIKE"
                 ]
               }
             ],
             "metadata": {
               "additionalProp1": {}
             }
           }
{
             "countDeviceCode": "CD-1002",
             "code": "DET-1002",
             "name": "Traffic-COUNT",
             "detectorLocation": {
               "shape": "POINT(13.4050 52.5200)",
               "heading": 90,
               "mapModelEntity": {
                 "entityId": "120022",
                 "entityType": "LINK",
                 "linkShapePercentFromNodeId": 0.5
               }
             },
             "allowedMeasures": [
               {
                 "measureTypeCode": "COUNTS",
                 "detectedVehicleTypeCodes": [
                   "CAR",
                   "BIKE"
                 ]
               }
             ],
             "metadata": {
               "additionalProp1": {}
             }
           }
         ]
       }
     ]
   }
 ]
}

It is important to notice that all elements of the above payload must be previously registered in your instance.