Jump to content

Initiate download through the API


Recommended Posts

Redshirt
Posted

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?

Posted

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.

Redshirt
Posted

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.

Posted

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
Redshirt
Posted

Sounds good. Thanks.

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...