Curl request directly from soundflow
Hi,
I'm not sure if this is even entirely possible, but I am wondering how I would go about submitting a curl request via an API directly from an SF script? This is for a smart bulb (but not Philips Hue).
Any ideas?
Thanks!
- DDylan Barber @Dylan_Barber
To elaborate on this a little more, I essentially want to tell one of my smart bulbs (used with Tuya Smart Life) to turn on and go red whenever Pro Tools or Logic goes into record mode. If that is even possible?
- In reply toDylan_Barber⬆:Christian Scheuer @chrscheuer2023-05-28 21:48:20.066Z
Hi Dylan,
You can make HTTP requests straight from SF -
Here's a pseudo example:sf.net.httpRequest({ url: `http://127.0.0.1:1000/blabla`, method: 'POST', data: { some: true, json: 'blabla', data: 1234, }, });
- DDylan Barber @Dylan_Barber
Thanks for the info Christian! Super helpful. One more Q I think (famous last words...); where would I put the header information for the request? in the url line?
Christian Scheuer @chrscheuer2023-05-29 16:31:04.141Z
There's a property called "headers" for
httpRequest
- example:sf.net.httpRequest({ url: `http://127.0.0.1:1000/blabla`, method: 'POST', headers: { 'Authentication': 'Bearer blablabla', }, data: { some: true, json: 'blabla', data: 1234, }, });
- In reply toDylan_Barber⬆:Christian Scheuer @chrscheuer2023-05-28 21:49:14.363Z
If you wanna go via CURL that's also possible (but less performant/flexible):
sf.system.exec({ commandLine: `curl .....`, });