Public API – POST Create Complete Zone

The Zones endpoint allows new Zones to be created within a particular Application. Each Zone may contain one or more Geofences, Geoline™, Bluetooth beacons, Actions and/or Conditions.

Now we allow to create a complete Zone with fences, actions and beacons in a single JSON request to the endpoint.

URL to call

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

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

image

Checkout is not applicable for Geolines™. The checkout feature is only available in SDK version 1.6 and above.

Example: JSON request to create a complete Zone which will be active all day with a circular geofence and a message action

{
    "security": {
        "customerApiKey": "4d3a1b60-4dc4-11e4-ad0a-a0481cdba483",
        "apiKey": "77c16870-360a-492b-84c6-d1790abe9cc0"
    },
    "content": {
        "zone": {
            "zoneName": "High Accident Warning Zone",
            "minimumRetriggerTime": "00:06",
            "enableCheckOut" : false,
            "activeAllDay": true,
            "fences": {               
                "circles": [
                    {
                        "name": "Test Circular fence with 8M radius",
                        "color": "#000fff",
                        "radius": 8,
                        "center": {
                            "latitude":  -37.8186454,
                            "longitude": 144.979882
                        },
                        "order": 1
                    }
                ],
                "polylines": [
                    {
                        "name": "Geoline near MCG",
                        "vertices": [
                            {
                                "latitude": -37.818717,
                                "longitude": 144.983085
                            },
                            {
                                "latitude": -37.81954,
                                "longitude": 144.982125
                            },
                            {
                                "latitude": -37.820298,
                                "longitude": 144.981894
                            }
                        ],
                        "order": 2
                    }
                ]
            },
            "actions": {               
                "messageActions": [
                    {
                        "name": "A Message Action",
                        "title": "Welcome to Bluedot Innovation",
                        "message": "Welcome to Bluedot Innovation Offices",
                        "conditions": {
                            "timeActive": [
                                {
                                    "from": {
                                        "time": "10:00",
                                        "period": "am"
                                    },
                                    "to": {
                                        "time": "02:00",
                                        "period": "pm"
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        }
    }
}

Response: JSON response to request 

 {
    "message": "Your request has been successfully processed.",
    "zoneId": "cc6f9dd1-3d69-454d-abdd-58176cbf67dc",
    "name": "High Accident Warning Zone",
    "fences":[ 
        { 
            "fenceName":"Test Circular fence with 8M radius",
            "fenceId":"c8873345-47eb-4e72-abde-eb6b1215a721"
        },
        { 
            "fenceName":"Geoline near MCG",
            "fenceId":"79a71476-48b0-4f65-9b83-87aa3d27669a"
        }
    ],
    "actions":[ 
        { 
            "actionId":"5de462f1-4899-4f19-90b1-d3b9f90da127",
            "actionName":"A Message Action"
        }
    ],
    "beacons":[],
    "messageCode": 200
}

Example: JSON request to create a complete Zone which will be active between 09:00 AM – 11:00 AM with a beacon and a custom action

Name
Required
Data Type
Description
Format
from Object The start time from when the Zone should be active from.
to Object The end time after when the Zone should not be active.
time String Time must use a 12 hour clock  HH:MM
period String The Time period of the day.  am/pm
{
    "security": {
        "customerApiKey": "4d3a1b60-4dc4-11e4-ad0a-a0481cdba483",
        "apiKey": "77c16870-360a-492b-84c6-d1790abe9cc0"
    },
    "content": {
        "zone": {
            "zoneName": "High Accident Warning Zone",
            "minimumRetriggerTime": "00:06",
            "enableCheckOut" : true,
            "timeActive": {
                "from": {
                    "time": "09:00",
                    "period": "am"
                },
                "to": {
                    "time": "11:00",
                    "period": "am"
                }
            },
            "beacons": [
                {
                    "beaconId": "b7db6f18-6557-4903-b0a7-b35b96d54fec",
                    "proximity": 1,
                    "order": 1
                },
                {
                    "beaconId": "b434e756-3d46-46e4-9d35-5a3da86dd564",
                    "proximity": 3,
                    "order": 2
                }
            ],
            "actions": {
                "customActions": [
                    {
                        "name": "A Custom action",
                        "conditions": {
                            "percentageCrossed": [
                                {
                                    "percentage": 65,
                                    "timeoutPeriod": "00:50",
                                    "sequential": true
                                }
                            ]
                        }
                    }
                ]
            }
        }
    }
}

Response: JSON response to request

{
    "message": "Your request has been successfully processed.",
    "zoneId": "cc6f9dd1-3d69-454d-abdd-58176cbf67dc",
    "name": "High Accident Warning Zone",
    "fences":[],
    "actions":[ 
        { 
            "actionId":"e5be998c-9cc0-4f04-85c4-fc4337763cc8",
            "actionName":"A Custom action"
        }
    ],
    "beacons":[
        "beaconId":"7cfc29cc-0679-46cf-83a1-0f9870d8440d",
        "beaconId": "b434e756-3d46-46e4-9d35-5a3da86dd564"
    ],
    "messageCode": 200
}

Source code examples

Created by Bluedot DevOps on March 3, 2018

Start the discussion