-
Notifications
You must be signed in to change notification settings - Fork 5
1.0 API Docs 🚫 Deprecated
Eureka can do a lot of heavy lifting on the front end, but without an API to connect to it has nothing to browse. You'll need to supply eureka with three properly formatted endpoints to fetch data from. Bonus points for supplying the optional directoryChildrenRequestURL
endpoint; it will make those request smaller.
var $eureka = new Eureka({ // init the Eureka component
// REQUIRED SETTINGS
uid:'media-browser_0', // id of our div
// if useWebWorkers is true these must be absolute paths or relative to the webserver root
directoryRequestURL:'fakepi/listdirectory.php',
listSourceRequestURL:'fakepi/listsource.php',
listSourcesRequestURL:'fakepi/listsources.php',
directoryChildrenRequestURL:'fakepi/listdirectorychildren.php' //optional
});
####directoryRequestURL
When instantiating Eureka
set directoryRequestURL
to an endpoint that will return the results of a given directory of a given media source in the format below. It should return the total number of results, the current directory, the current media source id, and an array of results. Results can be either a file or directory.
Each file must have:
- a
filename
- an absolute
src
URL -
filesize
in bytes -
editedon
in the number of seconds since the Unix Epoch - optional
dimensions
for images
{
"total":3,
"cd":".\/",
"cs":"0",
"results":[
{
"filename":"DSC02396",
"src":"http:\/\/jpdevries.s3.amazonaws.com\/mediabrowser\/assets\/images\/DSC02396.jpg",
"filesize":"1048576",
"dimensions":"600x600",
"editedon":"1266469440"
},
{
"filename":"DSC02491.jpg",
"src":"http:\/\/jpdevries.s3.amazonaws.com\/mediabrowser\/assets\/images\/DSC02491.jpg",
"filesize":"1024",
"dimensions":"600x600",
"editedon":"1353215040"
},
{
"directory":"foolder"
}
]
}
Just like directoryRequestURL
except returns only child directories. This is used by the navigation tree when expanded folders. If omitted, Eureka will use the directoryRequestURL
endpoint and ignore file results.
{
"total":1,
"cd":".\/",
"cs":"0",
"results":[
{
"directory":"foolder"
}
]
}
Set listSourceRequestURL
to an endpoint that returns the media source tree in the below format. Feel free to recurse as many depths as you wish. To be compatible with remote media sources such as Amazon S3 Eureka is design to fetch child directories asynchronously as needed. Therefore, you can get away with returning only the direct children of a media source.
{
"cs":"0",
"title":"Filesystem",
"results":[
{
"path":"assets",
"children":[
{
"path":"assets\/docs\/"
},
{
"path":"assets\/images\/"
}
]
},
{
"path":"uploads"
}
]
}
This simple endpoint should return a result of media sources to browse. Each media source must have a unique numeric id and a name.
{
"results":[
{
"id":0,
"name":"Filesystem"
},
{
"id":1,
"name":"Assets"
},
{
"id":2,
"name":"Amazon S3"
}
]
}