programmatic downloading and the v1 API

TimClark's Avatar

TimClark

05 Jan, 2011 04:45 AM via web

I'm interested in an auto-download/delete script, but I'm not able to figure out from the documentation if this is really supported.

If I get a "download_url" for an item, can I then pass that URL to curl like:

curl -u YOUR_PUT.IO_USERNAME:YOUR_PUT.IO_PASSWORD --location-trusted URL -o FILENAME.EXT -C -

I'd rather get a token from the API to perform a download rather than use a real user/pass, but the examples are only to assemble a separate streaming URL, which I don't care about in this case...

If this worked, I could create scripts for my media player that did clever things like: download all items in the X folder, and delete them after the download successfully completes.

  1. 2 Posted by TimClark on 05 Jan, 2011 06:29 AM

    TimClark's Avatar

    I didn't search enough. It looks like it definitely should work with curl, but requires the real credentials.

    Rephrased: are there plans to issue download tokens like streaming tokens are issued?

  2. 3 Posted by aft on 05 Jan, 2011 07:41 AM

    aft's Avatar

    Hey Tim,
    You can use streaming links for this. Streaming links doesn't require basic http auth credentials. It just requires a token as you mentioned.

    Check the "Building Audio/Video Stream URLs" section on this page: https://put.io/service/api/insight

    And the method you need to get the token is "acctoken"

    Here is a curl sample to get the token:

    curl -X POST "http://api.put.io/v1/user?method=acctoken" -d 'request={"api_key":"XXXXX","api_secret":"YYYYY", "params": {}}'
    

    Please let us know if you have further questions.

    Best regards,
    Cem

  3. aft closed this discussion on 05 Jan, 2011 07:41 AM.

  4. TimClark re-opened this discussion on 05 Jan, 2011 09:37 AM

  5. 4 Posted by TimClark on 05 Jan, 2011 09:37 AM

    TimClark's Avatar

    So is there any difference between the streaming URL and the download URL, other than the ability to use tokens? - Will I end up with the same file if I use curl to fetch?

    thanks!

  6. 5 Posted by aft on 05 Jan, 2011 10:47 AM

    aft's Avatar

    Hello,
    Yes. Only the authentication method differs. Since most of the video players don't support http auth, we use tokens for streaming urls.

    You may need to specify a file name when using stream urls. I'm not sure if curl will be able to detect the file name correctly.

    For wget, I use -O filename.ext parameter.

    Best regards,
    Cem

  7. aft closed this discussion on 05 Jan, 2011 10:47 AM.

Comments are currently closed for this discussion. You can start a new one.