Execute a http request on specific time

#1

Hi, i have some cronjobs which i want to migrate to nodered.
i am very new to nodered and have no idea how to execute an http request on a predefined time.
what i have done is, ive created a timestamp injection and reformatted the timestamp for my needings and wrote it to an mqtt topic. now i want to execute the desired http request if the topic has a specific time and date.

0 Likes

#2

Why do you need the MQTT node?
You can setup an INJECT node for the specific time and wire this directly to a HTTP REQUEST node.

0 Likes

#3

because i use the mqtt time object also for some other stuff.
how can i do the injection on specific time to a http req?

0 Likes

#4

so you will need MQTT-IN followed by a SWITCH node that checks for the time you want and then your HTTP REQUEST node but it is a very inefficient way of doing it.

0 Likes

#5

i understood. have created another inject node and wired it directly to the http req. that works for me.
thank you

0 Likes

#6

Just to repeat, the Inject node can be configured to inject at a specific time on specific days - just as you can with a cronjob.

Why complicate matters trying to co-ordinate it with your timestamp-to-mqtt flow?

0 Likes

#7

Hi,
ive already done that and modified the cron tasks regarding my needs in the json code.

0 Likes