# Execute a http request on specific time

**URL:** <https://discourse.nodered.org/t/execute-a-http-request-on-specific-time/3624>\
**Category:** General\
**Created:** [2 October 2018 10:42 UTC](https://discourse.nodered.org/t/execute-a-http-request-on-specific-time/3624 "2018-10-02T10:42:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rednode](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rednode](https://discourse.nodered.org/u/rednode)\
**Post date:** [2 October 2018 10:42 UTC](https://discourse.nodered.org/t/execute-a-http-request-on-specific-time/3624/1 "2018-10-02T10:42:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [2 October 2018 11:06 UTC](https://discourse.nodered.org/t/execute-a-http-request-on-specific-time/3624/2 "2018-10-02T11:06:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rednode](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rednode](https://discourse.nodered.org/u/rednode)\
**Post date:** [2 October 2018 11:08 UTC](https://discourse.nodered.org/t/execute-a-http-request-on-specific-time/3624/3 "2018-10-02T11:08:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [2 October 2018 11:17 UTC](https://discourse.nodered.org/t/execute-a-http-request-on-specific-time/3624/4 "2018-10-02T11:17:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rednode](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rednode](https://discourse.nodered.org/u/rednode)\
**Post date:** [2 October 2018 11:19 UTC](https://discourse.nodered.org/t/execute-a-http-request-on-specific-time/3624/5 "2018-10-02T11:19:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [2 October 2018 11:20 UTC](https://discourse.nodered.org/t/execute-a-http-request-on-specific-time/3624/6 "2018-10-02T11:20:39Z")

</div>

> [@rednode](#):
>
> how can i do the injection on specific time to a http req?

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?

---

<div class="post-metadata">

**Author:** ![rednode](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rednode](https://discourse.nodered.org/u/rednode)\
**Post date:** [2 October 2018 14:36 UTC](https://discourse.nodered.org/t/execute-a-http-request-on-specific-time/3624/7 "2018-10-02T14:36:08Z")

</div>

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