Public API – POST Create Multiple Fences

The fences end point allows new Geofences to be created and added to an existing Zone.

Geofences can be added regardless of whether the Zone was created using the zones API or via the web interface for the Bluedot back-end system, Point Access.

URL to call

https://api.bluedotinnovation.com/1/fences

Content Type

The content type should be specified in the Content-Type HTTP header as “application/json”.

image

Content-Type: application/json

Parameters

No URL Parameters required. See example JSON below.

Key JSON fields

N/A

Example: JSON request to create multiple fences for the same zone in the same request

{
    "security": {
        "customerApiKey": "bc199c80-5441-11e4-b7bb-a0481cdc3311",
        "apiKey": "d3161e80-38d1-11e4-b039-bc305bf60831"
    },
    "content": {
        "zone": {
            "zoneId": "95b8285d-f85d-48d1-9c4d-b2e7f12ec6bf",
            "fences": {
                "circles": [
                    {
                        "order": 1,
                        "name": "Circular fence with 8M radius",
                        "color": "#000fff",
                        "radius": 8,
                        "center": {
                            "latitude": -37.8159544565362,
                            "longitude": 144.9723565578461
                        }
                    },
                    {
                        "order": 2,
                        "name": "Circular fence with 16M radius",
                        "color": "#fff234",
                        "radius": 16,
                        "center": {
                            "latitude": -37.8164587537386,
                            "longitude": 144.978997707366
                        }
                    }
                ],
                "rectangles": [
                    {
                        "order": 3,
                        "name": "A bounding box with north east and south west",
                        "color": "#3559ef",
                        "northEast": {
                            "latitude": -37.81794619852986,
                            "longitude": 144.97999548912048
                        },
                        "southWest": {
                          "latitude": -37.81846319511329,
                          "longitude": 144.97921228408813
                        }
                    }
                ],
                "polygons": [
                    {
                        "order": 4,
                        "name": "A Polygonal Fence",
                        "color": "#000fff",
                        "vertices": [
                            {
                                "latitude": -37.81902680201739,
                                "longitude": 144.9821037054062
                            },
                            {
                                "latitude": -37.8196878692931,
                                "longitude": 144.98161554336548
                            },
                            {
                                "latitude": -37.82052267015026,
                                "longitude": 144.9816906452179
                            },
                            {
                                "latitude": -37.82128118660006,
                                "longitude": 144.98312830924988
                            },
                            {
                                "latitude": -37.82102693614463,
                                "longitude": 144.98458743095398
                            },
                            {
                                "latitude": -37.820196378553405,
                                "longitude": 144.98524725437164
                            },
                            {
                                "latitude": -37.81895899991077,
                                "longitude": 144.9847161769867
                            },
                            {
                                "latitude": -37.81865812731128,
                                "longitude": 144.9839222431183
                            },
                            {
                                "latitude": -37.81866660261256,
                                "longitude": 144.98308539390564
                            },
                            {
                                "latitude": -37.81902680201739,
                                "longitude": 144.9821037054062
                            }
                        ]
                    }
                ],
                "polylines": [
                    {
                        "order": 5,
                        "name": "Geoline test",
                        "color": "#000fff",
                        "vertices": [
                            {
                                "latitude": -37.818717,
                                "longitude": 144.983085
                            },
                            {
                                "latitude": -37.81954,
                                "longitude": 144.982125
                            },
                            {
                                "latitude": -37.820298,
                                "longitude": 144.985178
                            }
                        ]
                    }
                ]
            }
        }
    }
}

Example: JSON response to request

{
  "fencesUpdated": [
    {
      "fenceId": "e3710cd8-2773-4d22-af38-633485504bd7",
      "fenceName": "Circular fence with 8M radius"
    },
    {
      "fenceId": "c0f63d09-6a00-4886-8352-920be588f2e7",
      "fenceName": "Circular fence with 16M radius"
    },
    {
      "fenceId": "a7e0628b-1708-4ae1-b890-a850ac4257da",
      "fenceName": "A Polygonal Fence"
    },
    {
      "fenceId": "190e7a94-8f55-4708-97c1-fd8008d96ac9",
      "fenceName": "A bounding box with north east and south west"
    },
    {
      "fenceId": "5b270557-8d84-4a33-aafa-2c9b72069086",
      "fenceName": "Geoline test"
    }
  ],
  "message": "Your request has been successfully processed.",
  "messageCode": 200
}

Source code examples

Created by Bluedot DevOps on January 31, 2018

Start the discussion