Help with schedule criteria / API integration

CMS Version (and API version)

4.2.0 (on premise)

Player Type

Windows

Player Version

A somewhat recent version granted we installed this at most a few months ago, however I cannot seem to find how to view this information?

Issue

Hello.

I’m working on using Xibo to display up-to-date information from my organization’s case management system. The approach I’ve taken for this is to update DataSets via the Xibo API, which (with a bit of grueling detective work) I managed to get working quite smoothly!

One of the layouts I designed was meant to showcase important cases. For this layout, however, I wanted to control wheter it should be shown or hidden depending on if there were any important cases active.

The solution for this seemed obvious: Use schedule criteria! Even better, there was an API endpoint for it as well, specifically: POST /displaygroup/criteria[/{displayGroupId}].

Now, working with this endpoint has been an… interesting journey.
Here’s a bunch of “fun” undocumented discoveries I made while working with it:

  • Even though the description of the endpoint states that displayGroupId is an optional parameter, it is, in fact, not optional in the slightest.
  • Passing value as a string containing only numbers (such as "0"), will result in a HTTP 500 error urging you to contact support (and here I am!).

But, more importantly, it just does not work? At all? Despite responding with HTTP 204, absolutely nothing appears to work with these things. Let’s do a practical example:


  1. I make the following request to the Xibo API (it responds HTTP 204)

    response = requests.request(
        "POST",
        API_URL_XIBO + "/displaygroup/criteria/17", # This displaygroup is applied to all screens. 
        headers = {
            "Content-Type": "application/json",
            "Accept": "application/json",
            "Authorization": "Bearer " + access_token
        },
        json =  {
        "criteriaUpdates": [
            {
              "metric": "important_case_active",
              "value": "TRUE" if incident_count > 0 else "FALSE",
              "ttl": 0 # Infinite TTL? I've tried with 3600 as well.
            }
        ]},
        verify = False
    )
    

    (This is python, using the requests module to make API calls)

  2. I go to the schedule page on the Xibo CMS, and create a new event. I assign it a layout (or campaign, it doesn’t affect the outcome), and then set the criteria to the following:


    This screen is also pretty interesting.The API only supports strings, but the condition list here makes it seem that numbers are, in fact, supported. What’s going on here?

  3. I place the above event to my screens and wait for them to update. Once that’s done…

  4. The layouts assigned appear on screen! Always… regardless of what any criteria is set to. Even with a ridicolous criteria like (Wheather app) windSpeeds greaterThan 99999 it still kept showing up.I did also fiddle with priority and order, but that didn’t do anything either.


While we’re at it: is there any way to view criteria currently applied to a screen? Either it does not exist, or I simply cannot find it.

I apologize for the frustration, but this has been something of an experience to debug.
Is this a bug with criteria? Am I doing something wrong? Is there an alternative approach that can achieve the same results? (I can imagine something like deleting and creating new events via the API, but that sounds like a terribly unelegant solution).

Please help!

Regards,
Oskar Nilsson

If a schedule with criteria is being shown regardless you likely have a player version prior to one that supports criteria. The player version is shown on the display page if you want to check.

The API you’re using will push those criteria down to displays in your group via XMR push messaging; if that component isn’t working they won’t get sent.

@Nadz please can you comment on the observations regarding the API?

The primary use case for criteria is that they are set locally on the display and not via the CMS, and you’re right we don’t have a way to see that display side. We could add something to the status screen, i’ll record that feedback.

I’ve investigated the API, and it seems that using “0” as the value for value does indeed trigger an error. The API does supports numbers, as any non-zero number works fine, but the issue here is that value is a required attribute. When “0” is passed, it appears empty during CMS validation, which then triggers an error. This is a bug.

Regarding your use of schedule criteria, your approach is correct. However, the issue is that Xibo’s Windows Player does not support schedule criteria. Even though the API successfully pushes criteria down via XMR, the Windows Player lacks the capability to evaluate and trigger layouts based on those criteria.

The current players that support schedule criteria are Android, Tizen, and WebOS.

CMS Version (and API version)

4.2.0 (on premise)

Player Type

Android (Xibo for Android v4 R406)

I created a schedule and set the criteria value to GENDER.

  1. Local Player API Call

  2. XMR

I received status 402 in both cases, but my schedule is still not displayed.
The status remains (*=not scheduled).