Русский English

API to receive trigger events on player

      Contents:

General description of the request

The request is sent to the embedded HTTP server of the player to launch the playback of a certain ad.

The embedded HTTP server of the player works on the 127.0.0.1 interface and doesn't require authorization.

Base URL: http://127.0.0.1:9036/

GET current-playlist?frameId=<frameId> Current playlist for a frame

{
   "playlist": [1, 2, 13],
   "playlistEndTime: "12:12:45 09.05.2019", //optional
   "currentIndex": 0,
   "currentAdvertisement": 13,  //optional
   "lastTime": 3000
}

playlist - list of IDs of ads in the current playlist
playlistEndTime - time until which the playlist is valid (HH:mm:ss dd.MM.yyyy)
currentIndex - current position in the list of ads
lastTime - remaining time for the current ad in milliseconds

POST media-metering OTS

{
 period: 30000, // presence validity period in milliseconds
 count: 10, // may differ from the amount of mac addresses/people
 macAddresses:
     [ //optional
         {
             class: "WIFI",
             signal: "-89", //optional
             address: "A3FFD0897214"
         },
         {
             class: "BT",
             signal: "-89", //optional
             address: "1234567890AB"
         },
     ],
 people: 
     [ //optional
         {
             gender: "MALE",
             age: 21, //optional
             ageSegment: "20-30",
             uuid: null //optional
         },
         {
             gender: "FEMALE",
             age: 69, //optional
             ageSegment: "60-70",
             uuid: null //optional
         }
     ]
}

POST execute-trigger/<frameId> Triggers

Request body:

{
  "trigger": "18",
  "type": "interrupt",
  "timeout": 1
}
  • trigger — trigger name of the ad, mandatory field;
  • type — type of trigger, mandatory field;
  • timeout — time in milliseconds, mandatory field for certain types.

Types of triggers

type description
interrupt play right away
queue-or-interrupt play in n seconds, if the remaining playback time of the ad is less than the timeout time. Or play after the timeout
queue-or-discard play in n seconds, if the remaining playback time of the ad is less than the timeout time. Or cancel trigger
queue queue to play next

Field timeout is mandatory for the following types:

  • queue-or-interrupt
  • queue-or-discard

Server-side responses

200 OK

{
  "trigger": "18",
  "timeout": 2000
}

timeout — time in milliseconds until the player starts to play the trigger ad.

404 Not found

No such frame or such trigger event can be found on the player.

{
    "error": 404,
    "reason": "Frame %d not found",
    "trigger": "18",
}

400 Bad request

Error in request or in request body.

{
    "error": 400,
    "reason": "Error message",
    "trigger": "18",
}

412 Precondition Failed

Impossible to play trigger ad with type queue-or-discard (time condition can't be executed).

{
    "error": 412,
    "reason": "Error message",
    "trigger": "18",
    "possible-timeout": 7000  
}