Public API – POST URL Action

The actions endpoint allows new URL actions to be created and added to an existing Zone.

URL actions can be added regardless of whether the Zone was created using the public API or via the web interface for the Bluedot back-end system, Point Access. One or more conditions can be attached to an action as shown in the example below. Conditions can be added at a later stage through the update action.

URL to call

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

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.
actions Object The actions object is used to add the different action types (Message, URL and Custom).
urlActions Array The urlActions array is used to add one or more URL actions to the zone.
name String An identifying name for the URL action.
url String URL that will be opened when the device enters a zone.

Example: JSON request to create a URL action

 

{
    "security": {
        "customerApiKey": "bc199c80-5441-11e4-b7bb-a0481cdc3311",
        "apiKey": "d3161e80-38d1-11e4-b039-bc305bf60831"
    },
    "content": {
        "zone": {
            "zoneId": "24d9a245-2087-421b-9972-2af2ee0970f1",
            "actions": {
                "urlActions": [
                    {
                        "name": "A URL Action to open Bluedot web site",
                        "url": "http://wwww.bluedotinnovation.com"
                    }
                ]
            }
        }
    }
}

Example: JSON request to create a URL action with conditions

{
    "security": {
        "customerApiKey": "bc199c80-5441-11e4-b7bb-a0481cdc3311",
        "apiKey": "d3161e80-38d1-11e4-b039-bc305bf60831"
    },
    "content": {
        "zone": {
            "zoneId": "6de96865-f3c8-42cf-bdc2-38027272770a",
            "actions": {
                "urlActions": [
                    {
                        "name": "A URL Action to open Bluedot web site",
                        "url": "http://wwww.bluedotinnovation.com",
                        "conditions": {
                            "percentageCrossed": [
                                {
                                    "percentage": 50,
                                    "timeoutPeriod": "00:01",
                                    "sequential": false
                                }
                            ],
                            "dateRange": [
                                {
                                    "start": "12/12/2014",
                                    "end": "14/12/2015"
                                }
                            ],
                            "timeActive": [
                                {
                                    "from": {
                                        "time": "10:00",
                                        "period": "am"
                                    },
                                    "to": {
                                        "time": "2:00",
                                        "period": "pm"
                                    }
                                }
                            ],
                            "bearing": [
                                {
                                    "fromAngle": 80,
                                    "toAngle": 200
                                }
                            ],
                            "speed": [
                                {
                                    "minimumSpeed": 10,
                                    "maximumSpeed": 30
                                }
                            ]
                        }
                    }
                ]
            }
        }
    }
}

Example: JSON response to request

{
    "objectsUpdated": [
        {
            "actionId": "6e4ca82b-9a59-491f-8da2-a727cc224ec3",
            "actionName": "A URL Action to open Bluedot website"
        }
    ],
    "message": "Your request has been successfully processed.",
    "messageCode": 200
}

Source code examples

Created by Bluedot DevOps on March 3, 2018

Start the discussion