Trigger from / with url

Hi!

Can i trigger a node-red flow with just calling an url?

Just like 127.0.0.1:1880/some_url
and the start a flow

Thanks!

Yes - the HTTP In nodes do just that.

https://cookbook.nodered.org/http/create-an-http-endpoint

Cool it works, thanks to the example :wink:

Thanks for the info but need a bit help.
I have some cam's, blue iris (cam program) and deepstack (AI) analysing the pics if persons or not to reduce false trigging almost to zero. The AI program trigger with http commands to blue iris to record a sequence or not. The issue is that the AI program don't send mqtt but I can send in the AI program multi http commands. I want to send a simple http to my Node-RED to say cam number X is triggered so that Node-RED can prossesing things in my house upon this information. I use user and password in my Node-RED.

Could you give me an bold example since I don't figer out in the cookbook how to do it.

  1. URL like: http://192.168.0.88:1880/"and now I don't know what to do" in a browser or in the AI program (btw 192.168.0.88 is the IP of my Node-RED server)
  2. And how does it look in the Node-RED?

Thanks
Per

I am not that experienced in this area but it isn't clear exactly where your difficulty is. Is it that you don't know how to setup an http endpoint in node-red to receive the http message from the AI program or you don't know how to invoke that from the AI program?

Hi,
Thanks for responding :blush:
To make it really simple:
I want to send over http as example over my browser just some simple information, let's say
CAM01
ON
As I said in a http line to my Node-RED like:
Http://myNodeRed:1880/"and here the 2 information above"
How will this http line look like?

Then how to do a node or 2 look like in node red to get this information?

Just to get the info CAM01 and ON

Thanks :slight_smile:

When you enter an address in the browser you are doing an http GET (which is intended to just get information from a website). You can specify what information you want by adding parameters. So in your case you might use something like http://192.168.0.88:1880/myapi?cam01=on. This example in the cookbook shows you how to do this. However you shouldn't use a GET for telling the server to do something, you should use a POST for this. Part of the reason is that if you are looking at a page in the browser and you refresh the page it will issue the request again, so node-red would receive the request again and repeat whatever action you asked for. So to tell the server to do something you should always use an http POST where the instructions on what to do (cam01=on in this case) is sent in the request, not in the url. That is what happens with a form on a website for example, when you click the submit button it sends a POST to the server containing the information. There are three examples on how to do that in the http endpoints section of the cookbook at https://cookbook.nodered.org/#http-endpoints. I suggest you have a play with those examples and see how they work.

Thanks :blush::+1: I see the point with put and will play around the example in the cookbook

Are you able to generate POST requests in your AI software?

In the AI what sends a URL info to the cam web server looks like this:

http://192.168.0.200:81/admin?camera=[CAM01]&trigger&user={admin}&pw={1234}

(Original copy paste of the URL just the password is different :wink:)

Where 192.168.0.200:81 is the cam Web server

No I can't put something ahead of the http, just http://something. I can have multi http://something with "," between them but no PU T http://

You don't put POST before the http, it would have to know that you want to use POST. If you can't then you will just have to use get.

I googled for deepstack mqtt and found a number of links with people doing something that sounds similar to your requirement and using MQTT. It might be workth looking at all those to see if there is anything useful for you.

Thanks, yes I know somebody is using but the setup is a lot bigger then this one.
Ok different question, can I in a http format send "like" a mqtt way aktiv a information to red-node? Perhaps you did answer the question before, I just want to send a status to node-red.
Like triggering a light on and off from a browser http line to red-node?

That is answered by my post describing GET and POST (sorry I keep saying PUT when I mean POST), preferably you should use a POST for this, but in your case it should be ok using a standard http request (which is GET).
I will edit my previous posts.

Thanks, I will test around and when it works I will post here just for the record my solution, could be that someone else have the same issue