CS Player HTTP API

CS Player runs a built-in HTTP server that handles local API requests. The server listens on the 127.0.0.1 interface and does not require authentication.

Get the current playlist of a frame

GET /current-playlist?frameId=<frameId>
{
 "playlist": [1, 2, 13],
 "playlistEndTime": "12:12:45 09.05.2019",
 "currentIndex": 0,
 "currentAdvertisement": 13,
 "lastTime": 3000
}
Table 1. Current playlist object fields
Field Description

playlist

list of advertisement ids in the current playlist

playlistEndTime

time until which the playlist stays valid (HH:mm:ss dd.MM.yyyy)

currentIndex

current position in the advertisement list

lastTime

remaining time of the current advertisement, in milliseconds

Submit media metering data

POST /media-metering
 {
    "period": 30000,
    "count": 10,
    "macAddresses":
        [
            {
                "class": "WIFI",
                "signal": "-89",
                "address": "A3FFD0897214"
            },
            {
                "class": "BT",
                "signal": "-89",
                "address": "1234567890AB"
            }
        ]
}
Table 2. Media metering object fields
Field Description

period

Period, in milliseconds, during which the MAC addresses were registered

count

Number of unique contacts within period

macAddresses

Array of globally unique MAC addresses, optional field

macAddresses.class

MAC address type (WIFI / BlueTooth)

macAddresses.signal

Signal level of the packet the MAC address was taken from, optional field

macAddresses.address

MAC address

Set the current position of a mobile screen

POST position
{
    "lat": 56.082698,
    "lon": 47.305554
}
Table 3. Fields
Field Description

lat

latitude

lon

longitude

Trigger-based content playback

POST execute-trigger/<frameId>
{
    "trigger": "18",
    "type": "interrupt",
    "timeout": 1000
}
  • trigger — advertisement trigger identifier, required;

  • type — trigger type, required;

  • timeout — time in milliseconds, required for types:

    • queue-or-interrupt

    • queue-or-discard

Table 4. Trigger types
Type Description

interrupt

show immediately

queue-or-interrupt

show within n seconds if the time left until the end of the current advertisement is shorter than the timeout; otherwise show after the timeout

queue-or-discard

show within n seconds if the time left until the end of the current advertisement is shorter than the timeout; otherwise discard the trigger

queue

queue as the next advertisement

Server response examples

200 OK

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

timeout — time in milliseconds until the player starts showing the triggered advertisement.

404 Not found

No such frame or trigger event found on the player
{
  "error": 404,
 "reason": "Frame %d not found",
 "trigger": "18"
}

400 Bad request

Error in the request or the request body
{
 "error": 400,
 "reason": "Error message",
 "trigger": "18"
}

412 Precondition Failed

Returned when an advertisement with the queue-or-discard trigger type cannot be shown

The time condition cannot be met
{
 "error": 412,
 "reason": "Error message",
 "trigger": "18",
 "possible-timeout": 7000
}