Public API – POST Update Action with Condition

The actions end point allows existing Actions and Conditions to be updated. Zone Id, Action Id and Condition Id have to be provided for a successful update to occur.

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 for a Zone.
actionId String The identifier for an action. This can be retrieved via the zones end point.
conditionId String An identifier for a condition to update. This can be retrieved via the zones end point.
image

While updating actions the “name” field should not be sent as part of the request.

Example: JSON request to update a message action with a condition

{
    "security": {
        "customerApiKey": "bc199c80-5441-11e4-b7bb-a0481cdc3311",
        "apiKey": "d3161e80-38d1-11e4-b039-bc305bf60831"
    },
    "content": {
        "zone": {
            "zoneId": "5a5dffa2-89a1-443f-8598-b03feb860c18",
            "actions": {
                "messageActions": [
                    {
                        "actionId": "ee09c27a-2dbe-47c8-90f7-71439f4cf70b",
                        "title": "A Message Action is Being Updated",
                        "message": "Welcome to Bluedot Innovation message updated",
                        "conditions": {
                            "timeActive": [
                                {
                                    "conditionId": "43c4f1ba-1081-4dcd-a1b6-eedea9e1e0f1",
                                    "from": {
                                        "time": "10:00",
                                        "period": "pm"
                                    },
                                    "to": {
                                        "time": "2:00",
                                        "period": "am"
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        }
    }
}

Example: JSON request to update a custom action to add custom fields

To receive custom metadata as part of the custom action callback when a device moves into a Fence or comes in the range of a Beacon, add the custom fields envelope as part of the custom action POST request.

Name Required Data Type Description Format
key String The name of the metadata field to be returned as part of the custom action callback on the device.
value String The value of the metadata field to be returned as part of the custom action callback on the device.
{
    "security": {
        "customerApiKey": "bc199c80-5441-11e4-b7bb-a0481cdc3311",
        "apiKey": "d3161e80-38d1-11e4-b039-bc305bf60831"
    },
    "content": {
        "zone": {
            "zoneId": "5a5dffa2-89a1-443f-8598-b03feb860c18",
            "actions": {
                "customActions": [
                    {
                        "actionId": "ee09c27a-2dbe-47c8-90f7-71439f4cf70b",
                        "customFields":[
                            {
                                "key":"type",
                                "value":"Coffee Shop"
                            },
                            {
                                "key":"name",
                                "value":"Blue Bottle Coffee"
                            },
                            {
                                "key":"id",
                                "value":"48707775-4991-434b-ba3a-f41ac1236c44"
                            }
                        ]
                    }
                ]
            }
        }
    }
}

Example: JSON response to request

{
    "objectsUpdated": [
        {
            "actionId": "ee09c27a-2dbe-47c8-90f7-71439f4cf70b"
        }
    ],
    "message": "Your request has been successfully processed.",
    "messageCode": 200
}

Source code examples

Created by Bluedot DevOps on March 5, 2018

Start the discussion