Skip to content

Schedules

Matthew Martin edited this page Jun 9, 2020 · 3 revisions

/x-epi/schedules

GET

Returns a list of the schedules currently on the machine

HTTP Status Code: 200

Body: application/json

[
    {
        "label": string - a human readable title of the schedule
        "uid": string - the unique identifier for the schedule
    },
]

POST

Uploads a new schedule to the machine

Body: application/json

{
    "label": string - a human readable title of the schedule
    "description": string - a description of the schedule
    "files":    
    [
        { 
            "uid": string - the unique identifier for the audio resource to play,
            "times_to_play": integer - the number of times to play the audio resource. -1 = keep playing,
            "cron": string - when to play the audio resource in Cron format
        },...
     ],
    "playlists": 
    [
        { 
            "uid": string - the unique identifier for the playlist to play,
            "times_to_play": integer - the number of times to play the playlist. -1 = keep playing,
            "cron": string - when to play the playlist in Cron format,
            "shuffle": boolean true to shuffle the playlist
        },...
     ]
}

HTTP Status Code: 201

The schedule has been uploaded successfully

Body: application/json

{
    "result": boolean - true if this particular schedule was uploaded,
    "uid": string - the unique id of the resource that has been uploaded
}

HTTP Status Code: 400

The data sent to the endpoint was incorrect in some way

Body: application/json

{
    "result": boolean - false, 
    "reason": 
    [ 
        an array of strings giving the reasons for the failure 
    ],
    "data": 
    { 
        the json that was sent to the server 
    }
}

HTTP Status Code: 409

A schedule already exists on the server with the given label or the server could not create a unique id

Body: application/json

{
    "result": boolean - false, 
    "reason": 
    [ 
        an array of strings giving the reasons for the failure 
    ],
    "data": 
    { 
        the json that was sent to the server 
    }
}

HTTP Status Code: 423

Returned when the system has been locked using the Status API endpoint

Body: application/json

{
    "result": false,
    "reason": 
    [
        "the system is locked"
    ]
}
Clone this wiki locally