API support to Download Files

I’m using Stackstorm for Ansible playbooks executions.

I have installed st2 ansible pack

st2 pack install ansible

and using Stackstorm’s API to create executions for executing playbooks.

I have a bit specific usecase which require to download file on client-side (using http client) through rest-apis.

I can fetch files using ansible from control nodes (using ansible’s fetch module) on certain directories. but I need to download that file on client side through stackstorm rest apis…

suggest suitable solution for same…
Thanks

Hi @manoj-aps! Welcome to StackStorm!

To make sure I understand your question, are you saying you wish to HTTP GET a file from somewherel save it on the ST2 local server and then make it available via HTTP(s) from Stackstorm?

If I understood you correctly there are really two ways to accomplish this.

The first would be to build a flask server in docker that serves up a folder which the stanley user can write to, and have your sensor which pulls the file from somewhere write it to that directory. Here’s an example implementation: GitHub - Syncurity/syn-st2-flask. Keep in mind that I have other private code that modifies the files in app/static folders. I also have another repo that I use for running the flask app with docker-compose. GitHub - Syncurity/syn-st2-docker: Docker Services to Support Security Automation Brokers and Storage

The other option would be to take the approach this guy took with Palo Alto External Dynamic Block Lists: https://medium.com/@IrekRomaniuk/stackstorm-as-source-of-firewall-dynamic-list-1ff79f808a5f

Let me know if this helps.

I need to use StackStorm REST api interface to download files from remote machines. Please suggest if there is any api support for same.