-
All APIs are directly send to the backend of Private Cloud Music. For example,
api.php
on your server. and all APIs are using POST method. -
Content-Type of your request should be
x-www-form-urlencoded
. -
Use
do
parameter to specify what data is requested. and use other additional parameter accroding to yourdo
parameter. -
Always return a json to process. Contains a http
status
code node, amessage
node. and the most importantresult
node. -
result
node only avaliable if the request is legal. Contains the data contenttype
and the maindata
content.
-
POST:
- 'do' = "getserverinfo"
-
RETURN: json with the following struct.
{
"status": 200,
"message": "OK",
"result": {
"serverName": "Server Name",
"serverShortName": "SN",
"baseFolderNameHint": "sn",
"preferredFormatsHint": "mp3,ogg",
"apiVersion": 1,
"mediaRootUrl": "http://localhost/pcm/"
}
}
-
POST:
- 'do' = "getfilelist"
- 'folder' = folder name (optional, default value = "")
-
RETURN: json with the following struct. (if folder exist)
{
"status": 200,
"message": "OK",
"result":{
"type": "fileList",
"data": {
"musicList": [
{
"fileName": "FileName.mp3",
"fileSize": 123123123,
"modifiedTime": "1313065072",
"additionalInfo": false
},
{
"fileName": "FileName2.wav",
"fileSize": 123123123,
"modifiedTime": "1313065072",
"additionalInfo": false
}
],
"subFolderList": [
"FolderA/SubfolderA", "FolderA/SubfolderB"
]
}
}
}
Media file located at URL: mediaRootUrl
+ path
+ fileName
. mediaRootUrl
can be obtained from the getserverinfo
API, path
is the folder path of the current media file.
Once you get the URL, just feed the url to the player.
- RETURN:
- json with HTTP status code and error message.
{
"status": 400,
"message": "illegal request!",
}
We assume your Private Cloud Music backend can be access at url http://foo.bar/baz/api.php
and we use wget
for the following example.
wget --post-data "do=getfilelist&folder=Folder1" http://foo.bar/baz/api.php
If Folder1
exist, this will get the audio file list inside the folder named Folder1
. Since do
parameter value is getplaylist
. If that folder doesn't exist, will get an error contains the http status code and the error message.