I am new to the mAirlist community but very enthusiastic about the software and the way everybody is working together in this community.
Hopefully you can help me. I created a Simple Button and fire a script. I want the script to send a HTTP Post to node-red for some studio on-air switching. But… I can’t get HTTP Post working.
My solution is that I do it with curl in the script. But when I click the button the CMD view opens and closes after the script has run. Very annoying, while I think a HTTP Post is more simple.
Does anyone know what to put in a script to send a HTTP Post to a specific http://IP:port and a value to trigger something in node-red.
Please let me know.
For those interested. I have two buttons: ‘ON/OFF AIR’ and ‘CLAIM’. When I click the first button you have five seconds to click on the second one. Then the studio switches on-air or off-air. This logic is done in node-red where all of my studio switching is handled.
What is the curl command in your script like? It might give an idea how the trigger is firing things in node-red..
And is it a POST or a GET command with or without parameters that you need?
I had a similar issue triggering stuff to a vMix API, and I had to change it to a HTTP GET call which took me hours finding out why it wasn’t working..
@Tondose Shouldn’t it be possible to fire the http POST command from the mAirlist Script directly, that should eliminate the powershell or curl requirement completely.
I’m jumping in here, because I really want to learn how mAirlist handles the http GET/POST stuff in a script. That will open a lot of possibilities for me.
I struggle at the very beginning because there is HTTPPost and HTTPPostAsync and HTTPPostRaw What is the difference and what are the different use cases?
Difference between “async” functions and non-”async” (so “synchronous”) functions is that :
Synchronous : calling the function will wait for the answer before going on the next code instructions in the script. If call is very long, script is running during long time.
Asynchronous : calling the function will just send the call without waiting for this answer. So, script will going on after the call, no matter the http call result is.
And as far as I know, the “raw” function let us define more detail about the raw “body” part we use, in the http request (as in my example above).