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

/x-epi/files

GET

Returns a list of the audio resources currently on the machine

HTTP Status Code: 200

Body: application/json

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

POST

Uploads one audio resource to the machine

Body: multipart/form-data

  • label - string - a human readable title of the audio resource
  • description - string - a user entered description of the audio resource
  • file - file - the file containing the audio

HTTP Status Code: 201

The audio resource has been uploaded successfully

Body: application/json

{
    "result": boolean - true if this particular audio resource was uploaded,
    "uid": string - the unique id of the resource if it was uploaded,
    "details": 
    {
        "channels": integer - the number of audio channels,
        "created": string - iso date and time the resource was created,
        "description": string -  user entered description,
        "format": 
        {
            "subtype": string - the number of bits/sample and whether the sample is an int/float etc,
            "type": string - the type of audio file (wav, mp3, flac etc)
        },
        "label": string - a human readable title,
        "length": integer - length of the audio file in milliseconds,
        "locked": boolean - true if the file is locked because it is playing or queued to play,
        "path": string - the path to where the file lives on the Pi,
        "samplerate": integer - the sample rate of the audio file in Hz,
        "type": string - the resource type (either sndfile or mp3),
        "uid": string - the unique id of the resource,
        "valid": boolean - true if the file associated with the resource is valid audio
    }             
}

HTTP Status Code: 400

The data sent to the endpoint was incorrect ins some way

Body: application/json

{
    "result": boolean - false, 
    "reason": [ an array of strings giving the reasons for the failure ]
}

HTTP Status Code: 409

An audio resource 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 ]
}

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