1

I have a bunch of files, I'd like to push them all to filepicker and use various convert options to manipulate them.

How do I automate this process? Is there a way to do this outside of javascript with a traditional scripting language I can run from the command line?

freyfogle
  • 83
  • 5
  • Short answer: Sure. Longer answer: I imagine you're going to use *some* kind of language. What's your preference? VBScript or Powershell (Windows)? Bash (Linux/MacOS)? Visual Basic or C#? Perl? Something else entirely? – paulsm4 Jan 01 '13 at 23:39
  • http://WhatHaveYouTried.com ? Good luck. – shellter Jan 02 '13 at 02:02
  • My ideal language would be perl on linux commandline. My question is how do I authenticate and what are the urls to go against? The docs expose only a javascript interface. – freyfogle Jan 02 '13 at 14:13
  • 1
    @shelter I haven't tried anything as the docs expose only the javascript interface. I've asked here as the filepicker docs direct me to post here. – freyfogle Jan 02 '13 at 14:18

1 Answers1

4

The way to do this is as a POST to /api/store/S3 with the contents of the file. For instance

curl -F fileUpload=@test.html 'https://www.filepicker.io/api/store/S3?key={{apikey}}&filename=myCoolFile.html'

There are other tools that perform similar actions, such as https://github.com/uams/geturl, but the mechanism they use (posting to /api/path/storage) is out of date.

Overall, you can use this functionality, but the urls may change. We're fairly happy with the /api/store/[provider] syntax, but may change before release

brettcvz
  • 2,371
  • 1
  • 13
  • 14
  • very nice, thanks. One question though, is posting to FP like this outside of the defined API likely to work in the long term? Why not expose this API publicly? – freyfogle Jan 03 '13 at 10:37
  • For all those interested the solution is very basic, POST to https://www.filepicker.io/api/path/storage with the params `apikey` and `fileUpload`. Not sure why filepicker doesn't expose this in their docs. – freyfogle Jan 03 '13 at 15:34
  • Just haven't gotten around to doing it, closing down a number of improvements to the javascript and messaging before pushing more on the server-side APIs, libraries, and docs. I'd actually recommend hitting /api/store/S3 instead, same parameters, that's the url spec we're using going forward – brettcvz Jan 03 '13 at 18:33
  • Is that coming in the future, or do you mean it should be available now? When I try /api/store/S3 I get back the response 'Invalid Application' rather than valid JSON. – freyfogle Jan 03 '13 at 22:55
  • Thanks though you do realize those are NOT actually the same parameters, as you claimed. – freyfogle Jan 04 '13 at 09:56
  • Sorry man, just tested and that doesn't seem to work, still get 'Invalid Application', also I can't agree with your comment, geturl seems to use the old URL and params: https://github.com/uams/geturl/blob/master/geturl#L63 – freyfogle Jan 04 '13 at 10:14
  • Yes, my earlier comment was overly hasty. I updated the answer to be more correct. If you are getting "Invalid Application," check to make sure your API key is valid – brettcvz Jan 06 '13 at 01:05
  • It still works for me. Is there anyway we can get the url of uploaded item ? – Dzung Nguyen Mar 14 '13 at 22:43
  • The answer in the post is still correct, and will return a JSON object containing the URL of the uploaded file – brettcvz Mar 15 '13 at 00:24