Tapping into core/download?

Questions related to developing on the Tonido Platform
User avatar
madhan
Admin Tonidoid
Admin Tonidoid
Posts: 8617
Joined: Tue Dec 30, 2008 12:13 am
Location: Austin, TX, USA
Contact:

Re: Tapping into core/download?

Postby madhan » Sat Dec 18, 2010 4:51 pm

All HTTP APIs you see used by Tonido can be used by PHP apps themselves, including uploads and downloads.

You can use firebug to see the APIs in firefox and use them in PHP if you want.
These APIs are pretty much stable and won't change underneath in the future.

Regarding images and some formats appearing in browser, it is probably the http content disposition setting set to inline. I would suggest you using it as is for now and then we can add these as enhancements going forward.

User avatar
madhan
Admin Tonidoid
Admin Tonidoid
Posts: 8617
Joined: Tue Dec 30, 2008 12:13 am
Location: Austin, TX, USA
Contact:

Re: Tapping into core/download?

Postby madhan » Sat Dec 18, 2010 4:55 pm

In fact, we have wanted to write a PHP wrapper reusable library for all the HTTP API's supported by Tonido. We never got around to it.

For example, there are a lot of APIs in Tonido which return values in easy to parse XML. The PHP wrapper could parse the XML and make it ready to use.

User avatar
madhan
Admin Tonidoid
Admin Tonidoid
Posts: 8617
Joined: Tue Dec 30, 2008 12:13 am
Location: Austin, TX, USA
Contact:

Re: Tapping into core/download?

Postby madhan » Sun Dec 19, 2010 8:40 am

Please see
http://www.tonido.com/developer/sdk/doc ... tpapi.html

for some HTTP API. There are much more than this available, but not all documented.
Anything you see the UI do, there is API for it.

As much as possible wrap these APIs by your calls so that if the APIs change (if ever) it only affects a small part of your code.

spartacus
Super Tonidoid
Super Tonidoid
Posts: 34
Joined: Wed Oct 20, 2010 1:39 pm

Re: Tapping into core/download?

Postby spartacus » Thu Nov 10, 2011 5:04 pm

Hi;

I'm using Flash, connecting to my Tonido plug. So far, the docs have been great and I can authenticate and download things including images and music.

But... the upload doc is missing from the API. Thanks to this thread, I did find it, but can't seem to make it work.

I'm connecting to the plug on my internal network.

I'm using Flash File.upload() (using a file object obtained from the browse dialog) with the request:
http://192.168.2.145/upload (URLMethod=POST)
and variables:
appname=explorer,
path=/media/usb0 (URIEncoded),
expandzip=0

In response, I get an html page (from WebsharePro) that says the share name is invalid (not XML)

What am I missing?

Regards,

spartacus
Super Tonidoid
Super Tonidoid
Posts: 34
Joined: Wed Oct 20, 2010 1:39 pm

Re: Tapping into core/download?

Postby spartacus » Fri Nov 11, 2011 11:21 am

Thanks for responding.

Turns out that Flash ignores the

Code: Select all

contentType
for some requests (including upload) so no parameters were being sent.

User avatar
madhan
Admin Tonidoid
Admin Tonidoid
Posts: 8617
Joined: Tue Dec 30, 2008 12:13 am
Location: Austin, TX, USA
Contact:

Re: Tapping into core/download?

Postby madhan » Fri Nov 11, 2011 11:27 am

Does it work now?

spartacus
Super Tonidoid
Super Tonidoid
Posts: 34
Joined: Wed Oct 20, 2010 1:39 pm

Re: Tapping into core/download?

Postby spartacus » Fri Nov 11, 2011 6:06 pm

yes, very nicely.

1. Flash docs give conflicting info: FileReference says to pass variables in the request.data, but URLRequest says contentType not used for upload/download...

I haven't checked what is actually sent, but it says the parameters are passed as part of the multi-part form, so I suspect explorer is not looking at those...

2. I am getting error 2038 when I try sending a large-ish video, but not sure why...

3. Is there any way to get xml results from upload (as from core)?

Regards,

User avatar
madhan
Admin Tonidoid
Admin Tonidoid
Posts: 8617
Joined: Tue Dec 30, 2008 12:13 am
Location: Austin, TX, USA
Contact:

Re: Tapping into core/download?

Postby madhan » Sat Nov 12, 2011 9:50 am

1. You can enable "trace" level logging in Tonido and monitor the tonido.log file for details on all calls. Atleast the GET level params are shown.

2. How large are the files you are sending?

3. Unfortunately the upload currently only returns a simple string back, "OK" is success.


Return to “Tonido Platform Development”

Who is online

Users browsing this forum: No registered users and 3 guests