Simple GET method for adding file

Poke's Avatar

Poke

12 Aug, 2011 02:58 PM via web

Heya. After the discussion I've had on the issue below, I've decided to try to cook something up.
http://help.put.io/discussions/problems/1664-easily-add-a-new-download

I'm planning on converting the bookmarklet to use the API (simple enough, though I'm inexperienced with JSON). However, I wanted to ask if there's perhaps a simpler solution for the simple action of adding a file. I've looked around the API and found nothing that does this specifically.

I wish for a way to use a url to submit a link, with simple GET syntax, like used for search engines or mailto parsing. In fact, I'm very interested in using Firefox's native "Send to" feature. It'd show you the add transfer dialog, similar to the ff_ext unofficial api.
For example: http://put.io/add?url=http:%2F%2Ft0rrentz.tk%2Fmy.torrent

This'll also help create a simpler bookmarklet, instead of a client-server JSON conversations. Even better is the ability to have "Send to put.io" icons, which would be really cool to have on download sites.
The current API sorta does this, but it'll return a JSON reply to the user... and the syntax is iffy.

I understand you are busy folks, so this is merely a feature request (unless it's already possible with some unofficial api) for the next iteration of the API.

With gratitude,
Poke.

  1. Support Staff 2 Posted by FooVio on 12 Aug, 2011 03:25 PM

    FooVio's Avatar

    Hi Poke,
    If I understood your problem correctly, we have just the thing you need. You can add downloads using our API. To give you an example:

    http://api.put.io/v1/transfers?method=add&request={"api_key":"YOUR_API_KEY", "api_secret":"YOUR_API_SECRET", "params":{ "links":["HTTP://SOME_LINK", "HTTP://ANOTHER_LINK"], extract: true }}

    I hope this is helpful.

  2. 3 Posted by Idanbd on 12 Aug, 2011 03:36 PM

    Idanbd's Avatar

    I've tried using this, however I wrote that my issue was receiving a JSON
    reply, which is how the API works. I'm looking for something that works
    without javascript at all, but can be used in common interfaces such as the
    firefox "send to" feature.
    Also I was looking for something that doesn't require API_KEY and
    API_SECRET, but be intended for use in a browser environment with cookies.
    I'm looking for a *simple* GET method.

    I've snooped and the unofficial api can do this, using:
    https://put.io/default/ffext?ff_ext=1&ff_url=%s
    Where I replace %s with the intended url. I'm having issue with getting
    firefox4 to register it as a protocol, but it should work, no javascript
    needed.

    I'm still having the issue from the other thread though, where if i'm not
    logged in it won't remember my request when I do, and i need to resubmit the
    link. I'm not gonna ask you to maintain an unofficial API though, so I want
    to request something like this in the official API some day.

  3. Support Staff 4 Posted by FooVio on 15 Aug, 2011 04:26 PM

    FooVio's Avatar

    Hey all,
    I'm still working on the login problem but, for now you can use this to add your links:

    • You must first encode your link to base64. There are several free + easy to use online encoders. ( http://www.base64online.com/ for example ). Also if you are using this in the code, most of the languages have a base64 encoder.

    Then after /add/ just write your encoded link. For example:

    https://put.io/add/S25vY2ssIGtub2NrLCBOZW8u

    I hope this works for you.
    Regards.

  4. 5 Posted by Poke on 15 Aug, 2011 08:42 PM

    Poke's Avatar

    It doesn't seem to work for me. I've tried the following link but I just get "Torrent URL is not valid", perhaps too long? Doing it wrong?
    'https://put.io/add/aHR0cHM6Ly9kbC5idGp1bmtpZS5vcmcvdG9ycmVudC9VYnVu...='

    Anyway, that is almost what I wanted, except the base64 thing.
    With this I could write a script to add a torrent, but with the unofficial API right now I'm able to submit links without any script or extension, just by having firefox redirect torrents to put.io (as a web protocol for torrent files), because it'll accept plain urls in the query itself. I've actually considered this an alright hack for now and forgot about it.

    What you made is still better because this would save me clicking on "next" twice for every file added, which that old api needed.

    Thank you for your work, if this the syntax you decide on i'll write a script to use it when it's working. However if it could accept plain URLs, it would be perfect.

  5. 6 Posted by Poke on 15 Aug, 2011 08:44 PM

    Poke's Avatar

    Kinda messed up the url there
    https://put.io/add/aHR0cHM6Ly9kbC5idGp1bmtpZS5vcmcvdG9ycmVudC9VYnVudHUtMTEtMDQtRGVza3RvcC1kdmQtaTM4Ni14ODYtaXNvLzQzNTgxYTBmMmM1YWVkMDk3YzY0NWNjOTE5MjJkMWRlOWEyMmEzN2QxNDE5L2Rvd25sb2FkLnRvcnJlbnQ=

  6. Support Staff 7 Posted by FooVio on 16 Aug, 2011 09:45 AM

    FooVio's Avatar

    Thanx for the comment. We have to encode the URLs somehow and I don't know how the extension deals with plain URLs. We are thinking about re-writing the API and making some modifications. If we find a better solution, I will modify it. But for now, you can add a base64 decode method on your script.

    Also the link you gave seems to be working now. Do you still have the problem?

Reply to this discussion

Internal reply

Formatting help or Preview

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.