Jump to content

Initiate download through the API


Redshirt

Recommended Posts

Redshirt

This may show my ignorance of networking... but Is it possible for a plugin to add an API endpoint that when requested would return a physical file. Thus far I've only added endpoints that return serialized json structs.If it's possible, what is needed?

Link to comment
Share on other sites

Have your service implement IHasResultFactory. Then have your get method return ResultFactory.GetStaticFileResult.

 

I may need to add some new mime types depending on what you're going to be requesting.

Link to comment
Share on other sites

Redshirt

Books :) (pdf, mobi, epub)

 

Android devices can't view windows shares natively, so I believe the only way to get them is to initiate a download over the api. I think Windows RT is also in a similar situation as they can't touch the file-system.

Link to comment
Share on other sites

I don't think this endpoint should be in your plugin though as it's just a straight item downloader. That ought to go in the core. Otherwise if two plugins provide pdf's, the client has to know which plugin each one came from which seems nonsensical to me.

 

I'll add it to the next dev build. In the meantime keep going i guess so that you can test your client side stuff. it should be easy enough to wire up.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...