2011-07-30, 14:12
jasonvp Wrote:Hi Guys,
Does Files.Download work?
I tried this,
Code:{"jsonrpc":"2.0","id":1,"method":"Files.Download","params":"special://masterprofile/Thumbnails/Music/4/4484673b.tbn"}
All I get is,
Code:{"error":{"code":-32600,"message":"Invalid request."},"id":1,"jsonrpc":"2.0"}
Are my params incorrect?
That request is not valid on json-rpc 2.0 and has been changed in version 3, this is the schema for that method:
Code:
"Files.Download": {
"type": "method",
"transport": [ "Response", "FileDownload" ],
"permission": "ReadData",
"params": [
{ "name": "path", "type": "string", "required": true }
],
"returns": {
"type": "object",
"properties": {
"path": { "type": "string", "required": true }
}
}
}
So you need to do
Code:
{"jsonrpc":"2.0","id":1,"method":"Files.Download","params":{"path": "special://masterprofile/Thumbnails/Music/4/4484673b.tbn"}}
jasonvp Wrote:What does Files.Download return, the image or path?
Its hard to define what Files.Download "does" as it will depend on each transport. Essentially it initiates or prepares the server so that it can do a download, it will return something which will show you how to do the download. So parsing the data it returns depends on the transport.
To explain it way less complicated as the only transport implementing it is http, it will point to a path you can use to download the file.
Cheers,
Tobias