× Requests and support related to jBackend.

Endpoint to download a file

  • lcollong
  • Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 11 months ago #6648 by lcollong
Endpoint to download a file was created by lcollong
Hi Luigi,

We had write our own plugin to make available Fabrik's data to external apps through your mechanism and it works great.

The plugin answers with Json data which is fine for these cases.

We'd like to add an endpoint protected with an API key the same way as our current one but that would trigger a file download action answer instead of a json result. in other words, it would give back the file itself (pdf, jpg, csv...) instead of json data.
Is this could be implemented without breaking the Jbackend structure (log, stats, errors management ...) ?

The idea would be to give user possibility to use an url from their browser such as :

www.mysite.com/endpoint/download?api_key=mypersonnalapikey

Probably need to build an http answer rather than a json one ?

Would you have any advice or code snippets to start ?

Thanks,

Laurent

Please Log in or Create an account to join the conversation.

More
5 years 11 months ago #6656 by admin
Replied by admin on topic Endpoint to download a file
Well actually the jBackend response view can return only json responses, so if you want to make a "standard" request with logs and everithing a solution could be to generate a one time link and return it, and the client can make a second request to download the file. But you could also return the file in the action function of the plugin and end the script.

It will work in both cases, so decision is up to you.

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

  • lcollong
  • Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 11 months ago #6660 by lcollong
Replied by lcollong on topic Endpoint to download a file
I'll drive some tests. Thanks for your answer.
Best regards.
Laurent

Please Log in or Create an account to join the conversation.

More
5 years 11 months ago #6662 by admin
Replied by admin on topic Endpoint to download a file
Hi Laurent,
u're welcome and let me know if you need more information.

Luigi

Please Log in or Create an account to join the conversation.

Time to create page: 0.080 seconds