Can we generate access to the public for a file?
Is it possible to generate access to a particular file to all public users? We changed our project goal and it is largely dependant on that. All I see is granting access to a user in particular....
Certainly, in SmartFile, this is called a "link", it is a semi-randomized URL that provides access to a file or directory without any authentication. Links are served from the file.ac domain.
Use the Link API to generate a new link, the target path can be a file or directory. When visiting that URL, you will see the list of file(s) available at that location.
You can easily work out the direct URL to any of the given file(s) using the default link page and then code some logic to create them. Links can also be writable (accept uploads) if they point at a directory, or can allow browsing to sub directories. For example on my link, to directly access the file, use the following URL:
(yes, it really is just the file name or path following the link base URL). You can also append ?download=true to a "Content-Disposition: attachment;" header (which will cause the HTTP client to pop a save-as dialog instead of opening the file) if that is what you want.
Sometimes we offload transfers of links to a CDN (after 24h) but you can still use the file.ac URL to access the file contents, if the link is offloaded, your request will be redirected to the CDN URL, so be prepared to follow redirects (most HTTP clients do automatically).Reply
Sorry, a bit more on this topic.
There is actually a second way to achieve this, and which method you use will depend on your goals.
Links can be seen as permanent, public access. A link does not have very strong access control, it is meant to share files and even once deleted a file can still be available residually in caches or our CDN etc.
We also have the exchange API which allows for stronger access control. This is useful if you want to open access to a give file for a short period (the generated URLs are time-limited). They are also single-use, all the required security information is encoded in the URL, so they are temporary. We use this functionality when integrating with third party editors etc. You can also create writable exchange URLs (for saving back data).
You can read more about the exchange API here:
In a nutshell, a read-only exchange URL will accept a GET request, then it will become unusable. A writeable exchange URL will accept a POST request, then become unusable. In the case of a POST, there are a couple ways to send the file contents. Some information about that is at the above URL, if you need more information, let me know, but it sounds like you will be using GET requests.Reply
Here is an example exchange URL. I already used it up, but this should give an idea of what you get back from that API.