Public API – POST Update Fence

The fences endpoint allows existing geofences to be amended using a given Zone Id and Fence Id.

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

Name Required Data Type Description Format
customerApiKey String API key for customer (rather than the app).
apiKey String API key for the app.
zoneId String The identifier of the Zone being updated.
fenceId String The identifier of the Fence being updated.
name String Name given to the Fence.
color String Hex Color Code to represent the color of the Geofence. For example, “#FFFFFF” is white.

Example: JSON request to update a fence (requiring a centre point and radius)

Name Required Data Type Description Format
radius Number Double value representing the radius of a circular Geofence in metres.
center Object Coordinates for the center point of the circle.
latitude Number Latitude of the center of the circular fence.
longitude Number Longitude of the center of the circular fence.
{
    "security": {
        "customerApiKey": "bc199c80-5441-11e4-b7bb-a0481cdc3311",
        "apiKey": "d3161e80-38d1-11e4-b039-bc305bf60831"
    },
    "content": {
        "zone": {
            "zoneId": "24d9a245-2087-421b-9972-2af2ee0970f1",
            "fences": {
                "circles": [
                    {
                        "fenceId": "7cb10888-76cf-4564-b4ee-a20351352de4",
                        "name": "Test Circular fence with 8M radius updated",
                        "color": "#ff4fdf",
                        "radius": 8,
                        "center": {
                            "latitude": -37.8159544565362,
                            "longitude": 144.9723565578461
                        }
                    }
                ]
            }
        }
    }
}

Example: JSON request to update a bounding box (requires points for north east and south west)

Name Required Data Type Description Format
northEast Object Coordinates for the north-east point of a bounding box.

Consists of latitude and longitude fields.

southWest Object Coordinates for the south-west point of a bounding box.

Consists of latitude and longitude fields.

latitude Number Latitude of the north-east or south-west points of a bounding box
longitude Number Longitude of the north-east or south-west points of a bounding box
{
    "security": {
        "customerApiKey": "bc199c80-5441-11e4-b7bb-a0481cdc3311",
        "apiKey": "d3161e80-38d1-11e4-b039-bc305bf60831"
    },
    "content": {
        "zone": {
            "zoneId": "0956e181-e10d-440c-aa76-a44eb1964783",
            "fences": {
                "rectangles": [
                    {
                        "fenceId": "b9875caf-5d33-4bbd-bea3-2144e60eb41a",
                        "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
                        }
                    }
                ]
            }
        }
    }
}

Example: JSON request to update a polygonal fence (requires a series of points)

Name Required Data Type Description Format
vertices Array A polygon is made of multiple vertices. In the JSON, vertices is an array of more than 3 points, each having a latitude and longitude.
latitude Number Latitude of a vertex of a polygon
longitude Number Longitude of a vertex of a polygon
{
    "security": {
        "customerApiKey": "bc199c80-5441-11e4-b7bb-a0481cdc3311",
        "apiKey": "d3161e80-38d1-11e4-b039-bc305bf60831"
    },
    "content": {
        "zone": {
            "zoneId": "0956e181-e10d-440c-aa76-a44eb1964783",
            "fences": {
                "polygons": [
                    {
                        "fenceId": "36c9521e-3e8b-437a-a27d-9527c46a0b55",
                        "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
                            }
                        ]
                    }
                ]
            }
        }
    }
}

Example: JSON request to update a Geoline™ (requires a series of points)

Name Required Data Type Description Format
vertices Array A GEOLINE™️ is made of two or more points. In the JSON, vertices is an array of 2 or more points, each having a latitude and longitude
latitude Number Latitude for a point of a GEOLINE™.
longitude Number Longitude for a point of a GEOLINE™.
{
    "security": {
        "customerApiKey": "bc199c80-5441-11e4-b7bb-a0481cdc3311",
        "apiKey": "d3161e80-38d1-11e4-b039-bc305bf60831"
    },
    "content": {
        "zone": {
            "zoneId": "0956e181-e10d-440c-aa76-a44eb1964783",
            "fences": {
                "polylines": [
                    {
                        "fenceId": "36c9521e-3e8b-437a-a27d-9527c46a0b67",
                        "name": "PolyLine Around MCG",
                        "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": "7cb10888-76cf-4564-b4ee-a20351352de4",
            "fenceName": "Test Circular fence with 8M radius updated"
        }
    ],
    "message": "Your request has been successfully processed.",
    "messageCode": 200
}

Source code examples

Created by Bluedot DevOps on March 5, 2018

Start the discussion