#Here is the header i need to inject

1 messages ยท Page 1 of 1 (latest)

livid maple
#

okay. so you've got a couple of those that need to flow?

dreamy crag
livid maple
#

What about a change node after the cronplus node?

dreamy crag
#

i want to use chronplus at specific times of hour (which regular inject can;t)

dreamy crag
#

Seems to be working ๐Ÿ™‚

#

how do we create these threads, while replying?

livid maple
#

just right click like a reply and select create thread.

dreamy crag
#

Hey talking of the JSON thing in Chronplus, i did not quite get it. Do you mean we can get away with change node and just enter msg.header and msg.useragent in JSON option in chron node itself?

#

can you copy paste me a JSOn code for it for say msg.header., i will edit it for more

livid maple
#

Yup. In fact, if you get your change node set up the way you want, you can click copy value (via debug node) and drop the value right into the cronplus JSON payload.

#

I just tried it by copying my object back into the Edit JSON window.

#

had to help the formatting a little bit but it matched the original object that I pushed out of the node.

dreamy crag
#

Dont think its correct

#

sorry i dont quite know the json formatting so asked for an code example, so that i can add multiple ones

livid maple
#

I think it is definitely a start. the only thing I'm not sure how to do is get it from the msg.payload, into the msg.header. I think it needs another 'header : {' thing but I'm not sure.

#

@wintry swan can you jump in here and help with JSON syntax?

dreamy crag
#

Ok. Here are the things i need injecting

  1. msg.header =en-US,en;q=0.5
  2. msg.User-Agent = Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/95.0
livid maple
#

also, I think for your schedule you should be able to use 0/5 * * * *

dreamy crag
livid maple
#

I'm pretty sure that's what that will do. you will get injects at 5, 10, 15, etc. Basically minutes / 5.

dreamy crag
livid maple
#
{
    "header": {
        "Accept-Language": "en-US,en;q=0.5",
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/95.0 "
    }
}```
dreamy crag
livid maple
#

I don't believe so. it is based off of the system time; not deployment time.

dreamy crag
#

interesting, let me try 0/5

livid maple
#

cron is commonly used in Linux systems, particularly servers, to set up when tasks are to be performed.

#

the drop-down should tell you what you have it set as and should tell you when the next firing will occur.

#

(forgot cronplus allows seconds to be defined hence the preceeding 0)

dreamy crag
#

change node

livid maple
#

Think I got it fixed: JSON { "Accept-Language": "en-US,en;q=0.5", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/95.0 " }

dreamy crag
livid maple
#

top of the cronplus node

dreamy crag
#

Thanks. Looks like lot of work.
so if say i need another property in future like msg.payload too, this setup will not work. Correct?

I think change node solution is simpler for newbies like me ๐Ÿ˜„

livid maple
#

Unfortunately, it looks like you have to set your highest level object. So it can't do msg.payload and msg.headers. But it could do msg.payload, msg.payload.headers, and msg.payload.somethingelse.

#

but you could just use a change node to move the msg.payload.headers to msg.headers.

#

and then you would have "access" to put data into the msg.payload. You'd have to go back to the original JSON where the second line was "headers": { and add an ending } to enclose it.

dreamy crag
#

Ok. Thanks for all your help. I guess i will simply use the change node. But its good that you learnt too abt json from other guyand me too learnt a thing or 2 in my tiny brain..lol

livid maple
#

I keep stuff this this in a separate tab for future reference.

#

Just random stuff that I've played with all in the learning process.