entries/downloadfile
This call allows users to download files that were attached to entries inside Staction.
This function does not require POST authentication with the API credentials.
URL
http://api.staction.com/entries/downloadfile.format
HTTP Method:
GET
Required Parameters
All parameters on this call are required.
userId
: the ID of the user requesting the file.fileHash
: the hash code of the file that should be served. This hash can be found on return values of entries/list calls.
Examples
http://api.staction.com/entries/downloadfile.json?userId=123&fileHash=d751862f01fdf66803a6ac9f967c093cee7e65df
Expected Responses
If the call runs properly, it will return the file you’re trying to load, ready to be downloaded or shown in a browser or inside or your application.
If the call fails to be executed properly, the API will return an error in the default error format, with a status
field set to false
, and a reason
field explaining why it failed to run (respecting the format requested).
Authentication for file downloads
Authentication for file downloads is done differently for this call. We require the POST authentication for nearly all other calls to the API. On this call, we check to see if there has been any logged and successfully authenticated activity from the requesting user over the last few minutes. If you just loaded the stream of an account or check for new content every minute, you shouldn’t have any problems opening files.
If for some reason there’s been no activity on the stream, you can do a simple call just to authenticate the user before opening the file (like the one to test credentials, for example).