2

According to the docs here https://developers.filepicker.io/docs/web/#fpurl-store it is possible to use filepicker.io rest api for storing files.

I'm using following code snipper and it works fine:

curl -X POST -d "url=http://palmzlib.sourceforge.net/images/pengbrew.png" https://www.filepicker.io/api/store/S3?key=MY_API_KEY

with result:

{"url": "https://www.filepicker.io/api/file/zLyCHlbLSZuvtdj49Tqu", "size": 4462, "type": "image/png", "key": "ode7cMaoQxa8vMGaR3hl_pengbrew.png", "filename": "pengbrew.png"}

Now I would like to know the names of supported parameters.

I would like to be able to pass the same parameters that are accessible in javascript API (https://developers.filepicker.io/docs/web/#store): path, access etc.

The following call returns almost the same result as the first one:

curl -X POST -d "path=/images/image.png&url=http://palmzlib.sourceforge.net/images/pengbrew.png" https://www.filepicker.io/api/store/S3?key=MY_API_KEY

with result:

{"url": "https://www.filepicker.io/api/file/B1cxzO4ERQahOjW37X24", "size": 4462, "type": "image/png", "key": "b0WNFupeQxGE0KW2rlpg_pengbrew.png", "filename": "pengbrew.png"}

I'm expecting key property of response to be different. Is it supported and how to do that? I also want to make such file public on S3.

2 Answers2

3

Ok, found an answer by myself. Parameters should be specified in another place:

curl -X POST -d "url=palmzlib.sourceforge.net/images/pengbrew.png"; "filepicker.io/api/store/S3?key=MY_API_KEY&path=/images/…;

worked with response:

{"url": "filepicker.io/api/file/8YpJYYdhT8uL5dL2BpYg";, "size": 4462, "type": "image/png", "key": "images/image1.png", "filename": "pengbrew.png"}

0

This just totally saved me another several hours of sweating. It's a shame the documentation isn't better, but this is a good starting point.

the one thing I'd like to add (and is inferred here) is that the options specified in https://developers.inkfilepicker.com/docs/web/#store can all be appended. For example, extending the above example as

curl -X POST -d "url=palmzlib.sourceforge.net/images/pengbrew.png"; "filepicker.io/api/store/S3?key=MY_API_KEY&path=/images/&access=public"

wille store the uploaded file in /images/ and make it public.

user2463934
  • 21
  • 1
  • 5