Associate beacons and triggers (PUT)

Associates the specified beacons with the specified triggers.

Description

Use this API to specify a trigger and the list of beacons to associate with it. Or to specify a beacon and the list of triggers to associate with it.

Roles

Users in the following roles are authorized to perform this operation:

  • worklightadmin
  • worklightdeployer
  • worklightmonitor
  • worklightoperator

Method

PUT

Path

/management-apis/1.0/runtimes/runtime-name/beaconTriggerAssociations/applications/application-name

Example

https://www.example.com/worklightadmin/management-apis/1.0/runtimes/myruntime/beaconTriggerAssociations/applications/myapplication?locale=de_DE

Path Parameters

runtime-name
The name of the runtime. This is the context root of the runtime web application, without the leading slash.
application-name
The name of the application.

Query Parameters

Query parameters are optional.

locale
The locale used for error messages.

Consumes

application/json, application/xml, text/xml

Produces

application/json, application/xml, text/xml

Payload

The payload has values for the beacons and the trigger names. It can be in JSON or XML format.

JSON Example

{
  "beacons" : [
    {
      "major" : 1,
      "minor" : 4439,
      "uuid" : "3d402cf0-3691-4bd9-97ff-0b0a93a160ef",
    },
    ...
  ],
  "triggers" : [
    {
      "triggerName" : "DwellInsideLoanSection",
    },
    ...
  ],
}

XML Example

<?xml version="1.0" encoding="UTF-8"?>
<beaconTriggerAssociations>
  <beacons>
    <beacon
      major="1"
      minor="4439"
      uuid="3d402cf0-3691-4bd9-97ff-0b0a93a160ef"/>
    ...
  </beacons>
  <triggers>
    <trigger triggerName="DwellInsideLoanSection"/>
    ...
  </triggers>
</beaconTriggerAssociations>

Payload Properties

The payload has the following properties:
beacons
List of beacons to which each of the listed triggers must be associated with. Each beacon is identified by its UUID, major and minor number.
triggers
List of triggers to which each of the listed beacons must be associated with. Each beacon-trigger is identified by its triggerName.

The beaconTriggers has the following properties:

triggerName
The name of beacon-trigger.

The beacons has the following properties:

major
The major number of the beacon.
minor
The minor number of the beacon.
uuid
The UUID of the beacon.

Response

The status of the association of beacons and triggers.

JSON Example

{
  "beaconTriggerAssociations" : [
    {
      "major" : 1,
      "minor" : 4439,
      "triggerName" : "DwellInsideLoanSection",
      "uuid" : "3d402cf0-3691-4bd9-97ff-0b0a93a160ef",
    },
    ...
  ],
  "productVersion" : "7.0.0",
  "transaction" : {
    "appServerId" : "Tomcat",
    "errors" : [
      {
      },
      ...
    ],
    "id" : 1,
    "project" : {
      "name" : "myproject",
    },
    "status" : "SUCCESS",
    "timeCreated" : "2014-11-14T05:21:13.404Z",
    "timeUpdated" : "2014-11-14T05:21:13.456Z",
    "type" : "ASSOCIATE_BEACONS_AND_TRIGGERS",
    "userName" : "demouser",
    "warnings" : [
      {
      },
      ...
    ],
  },
}

XML Example

<?xml version="1.0" encoding="UTF-8"?>
<add-beacon-trigger-associations-result productVersion="7.0.0">
  <beaconTriggerAssociations>
    <beaconTriggerAssociation
      major="1"
      minor="4439"
      triggerName="DwellInsideLoanSection"
      uuid="3d402cf0-3691-4bd9-97ff-0b0a93a160ef"/>
    ...
  </beaconTriggerAssociations>
  <transaction
    appServerId="Tomcat"
    id="1"
    status="SUCCESS"
    timeCreated="2014-11-14T05:21:13.404Z"
    timeUpdated="2014-11-14T05:21:13.456Z"
    type="ASSOCIATE_BEACONS_AND_TRIGGERS"
    userName="demouser">
    <errors>
      <error/>
      ...
    </errors>
    <project name="myproject"/>
    <warnings>
      <warning/>
      ...
    </warnings>
  </transaction>
</add-beacon-trigger-associations-result>

Response Properties

The response has the following properties:

beaconTriggerAssociations
The list of the beacon trigger associations that are created.
productVersion
The exact product version.
transaction
The details of the transaction.

The beaconTriggerAssociations has the following properties:

major
The major number of the beacon that is associated with a specified beacon-trigger.
minor
The minor number of the beacon that is associated with a specified beacon-trigger.
triggerName
An unique name for this beacon trigger.
uuid
The UUID of the beacon that is associated with a specified beacon-trigger.

The transaction has the following properties:

appServerId
The id of the web application server.
errors
Errors, if any, that occurred during the transaction.
id
The id of the transaction.
project
The current project.
status
The state of the transaction: SUCCESS, FAILURE.
timeCreated
The date in ISO 8601 format when the transaction was started.
timeUpdated
The date in ISO 8601 format when the transaction was completed.
type
The type of the transaction: ASSOCIATE_BEACONS_AND_TRIGGERS.
userName
The user that initiated the transaction.
warnings
Warnings, if any, that occurred during the transaction.

The project has the following properties:

name
The name of the project, which is the context root of the runtime.

Errors

400
Bad Request - The request could not be understood by the server due to malformed syntax.
401
Unauthorized - The caller is either not authenticated or not authorized to make this request.
404
Not Found - One/more of the specified beacons or beacon-triggers not found.
406
Unsupported Accept type - The content type specified in Accept header is not application/json, application/xml or text/xml.
415
Unsupported Media Type - The server is refusing to service the request because the request payload is not in application/json or application/xml or text/xml types.
500
An internal error occurred.