Skip to content
Matthew Martin edited this page Aug 27, 2020 · 6 revisions

/x-epi/status

GET

Returns the current playing status of the machine

HTTP Status Code: 200

Body: application/json

If no resource is being played

{
    "player": "Stopped",
    "locked": boolean - true if the system is locked
}    

If an error has occurred and a player has become orphaned (this could be caused by the episerver stopping whilst a player is running)

{
    "player": "Orphaned",
    "locked": boolean - true if the system is locked
}    

If a resource is playing

{
    "player": "Running",
    "locked": boolean - true if the system is locked,
    "resource": 
    {
         "type": string - one of "sndfile", "mp3file", "playlist", "schedule",
         "uid": string the unique identifer for the resource,
         "label": the human readable title of the resorce
    },
    "status" : 
    {
        "action" : string - one of "Playing" or "Idle",
        "playing" : (only shown if "action"="Playing)
        {
            "length" : integer - the length of the audio resource currently playing in milliseconds,
            "loop" : integer - the number of times the audio resource has been sequentially played,
            "path" : string - full path to the audio resource on the server
            "started_at" : string - iso date and time of when the audio resource started playing
            "time" : integer - the number of milliseconds the player is through the audio resource,
            "uid" : string - the unique identifer of the audio resource,
            "resampler" : bool - true if the sample rate converter is being used,
            "samplerate" : only included if the sample rate converter is being used
            {
                "out" : integer  - the output sample rate,
                "in" : integer - the file sample rate
            }
        },
        "time" : string - the current time in ISO date/time format
    }
}    

PATCH

Starts or stops the player

Body: application/json

To start the player

{
    "command": "play",
    "type": string - the type of resource to play one of "file", "schedule" or "playlist",
    "uid": string the unique identifer for the resource to play,
    "times_to_play": integer - the number of times to play the resource (not needed if type is "schedule"),
    "shuffle": boolean - whether to shuffle the playlist or not (only needed if type is "playlist")
}

To stop the player

{
    "command": "stop"
}

To kill orphaned players

{
    "command" : "kill"
}

To lock/unlock the player. When locked all POST and PUT requests will return a 423 (locked) response code

{
    "command": "lock"
    "lock": boolean - true to lock, false to unlock
    "password": string  - on locking any string, on unlocking the same string as that used to lock the system
}

HTTP Response Code: 200

Returned when the command has been successfully actioned

Body: application/json

{
    "result": true
}

HTTP Response Code: 400

Returned if there is an error in the JSON sent to the server

Body: application/json

{
    "result": false,
    "reason": 
    [
        string - a reason for the failure,
        ....
    ]
}

HTTP Response Code: 404

Returned if the resource can not be found

Body: application/json

{
    "result": false,
    "reason": 
    [
        string - a reason for the failure,
        ....
    ]
}

HTTP Response Code: 500

Returned if the player cannot be started.

Body: application/json

{
    "result": false,
    "reason": 
    [
        string - a reason for the failure,
        ....
    ]
}

HTTP Status Code: 423

Returned when the system has been locked using the Status API endpoint and the PUT request is not attempting to change the lock.

Body: application/json

{
    "result": false,
    "reason": 
    [
        "the system is locked"
    ]
}

Clone this wiki locally