Absolute beginner with Node-RED: Using "HTTP in" to start a flow (REST Endpoint)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
for me [Applause] yeah hello yeah so that's the second uh live stream today accidentally live stream uh i want to do it once more because yeah the first one yeah there was a little bit of weird functionality so i want to do it once more and want to show you in a row yeah so it's a very it is a very simple topic with the node red and i have running the node red on ibm cloud here on a kubernetes cluster if you want to watch that how to set it up you can just watch what the last live stream i did it's a very long live stream it was uh the second christmas day and you can see how to set it up and run it for no cost yeah why do i do that live stream today um i got a question so but before i uh before you can see where to go the question i must use the magic of ubs and here going here and now i like yeah that's if these effects are now getting bit yeah so smaller big small okay so um i got um that question here on my um live stream i created related to rest endpoints you know that you get femina with red rest end points for uh absolute beginner for beginner with node-red and starting with programming and understanding all these rest endpoint stuff yeah which is a little bit weird when you're a beginner and here i got that a question here not written in language i understand yeah but google thanks i translated it and can i perform an action after an http in request and i expect the question is related that you get yeah these http interquests and how you work with that i said uh yeah that um or that what i showed in that video and you normally should not do that here with the with that directly use it here so i i prefer to use um flow variables to make that really uh separated but i want to show you today how you can do that and this is a wedded question and so i will also add the link to that live stream today yeah um with that in mind we go to the node-red instance i have running here so now i also have it a little bit more here bigger so that you can see it here so and that's the node red here running with a flow so the first thing what we are going to do is that we are i get but it's now so big that i must reuse it a little bit so here um now we're going to uh add an http in request so here is an httpn now we're going to configure that's a get and i call these get because we want something to start and i want then to name it as start number one okay that is here our get yeah get method http in so when we deploy it so [Music] that means when we did that that our node-red now we can invoke with that okay with that get get some information that was start uh zero yeah so and you see nothing happens because that what now is missing yeah it is missing that um we do not get any response and i haven't and i haven't deployed for sure so once again yeah but nothing happens there's nothing to return and that is what you need really to understand if you're if you provide an http in yeah there must be an http response so and by the way you you know here it's always good also to take a look here in the information so we have that and now we can wire that so and with that so we are fine or we should be fine yeah when i now invoke it here we can see here something so we get something returned here okay very simple um and now i will also add a digital informal because it gets up and we do get a get and i will add a function here and now we do that function here in the middle of that yeah does it work so and when we put that function in the middle yeah we define what the return value is when we see here at the moment we have nothing to response here and now when we do that and now we do here message message dot we provide the information with the payload pay load avoid misspelling so and then i provide it in um json format message here and i i say here just and i i i started zero one yeah zero one and that's that's all that's okay okay now the payload is defined when we take a look here in in the http response we will see here we can also specify additional header stuff and so on but what it will be uh will be a return now when we invoke we will get returned what we have provided here in the payload so now it should be here like that and now we have this that that's uh that was the little bit strange behavior and now i understand maybe what it was when but now when you now see when i invoke it it doesn't work yeah that's and that's a little bit weird and i think this is really something related because i i started with that with that um first configuration because that's right that's totally right everything is right here and i will now and that was what is a little bit strange when i when when i delete it here and and even when i delete it that doesn't work and now i log out yeah log on again i have a new instance and i created new not the new incentives yes here so just nothing is cached so i go here to the http in hello yeah so then and now we're going to the response and now we know what we want to do here so it's nothing at the additional so this was here that was the name star01 that's okay excuse me ah yeah no so now we going here message message msg and then we have here payload and that is and then and we give the payload here ah that was wrong message dot hmm uh what was this was start 701 so okay um so we go to the debug window we also take a look at the debug window about what happens here if it is triggered and so that we see what what happens so now and now you see it works and that was a little bit strange it doesn't work yeah when you see now it works and it's much better in that situation in that live stream yeah so that was a little bit weird and i i would say that this is a bug of not red so now it works you can see yeah as designed so what i want uh to show you now because that doesn't really reflect what the question is yeah the question was yeah ah can i start something and with that you know uh we even if you just use a get a get functionality here you can trigger something or you can start a flow here with that that means yeah that would be possible and to reflect these i want to use here um dashboard functionality i have installed the dashboard i like the dashboard yeah you have seen the dashboard maybe in or you can see the dashboard using in one of the other live streams when i create the absolute beginner flow yeah and here you can see with manage palettes here or what i have installed and this is here the node.red dashboard yeah and that is what i what i'm using now just to sew it to show something and here in the first step we're going to use uh just as an output and text yeah so that's uh and text we use and we use the text here which is coming from here so that means that directly shows we could also start from here and something is started yeah what makes sense and that's the question at the moment but with that um yeah uh a get is not really normally used to start something in that situation yeah but i want to show it first here and then we do also use um let me say a post request so that is first the get request which is normally only used for or it's used for uh it's intended to be providing information that you provide information output that means dev and that is started something here happens yeah maybe you connect to a database and gathering information and provide it here and so on and so that that is normally the intention yeah and um now we uh configure that um ui component so the ui means when i put it here i know it's not configured properly at the moment so we can here go to my dreading stance and you you know use a new uh that was wrong the ui so you can see here that's the dashboard nothing is currently in the dashboard we need to configure so we have here a layout so that is nice to see when you go here to the dashboard you can hear now see your structure i create a new tab so um i say edit and i say this is i call it stream information okay that's my tab got stream information the site information we can say here called happy stream uh stream you can select something here so okay now we define a group so when we deploy that we can see a happy stream the name and now we define a group inside that tab so uh plus a group that is uh we edit it and call it here simple ah i call it this is get let's get get uh for the http in yeah okay now we get our family with how that works and finally yeah so now we got that yes and finally now we can give this object we have here you know this uh text output we can now say oh where it lives and it lives here so we can see that's out of the box selected because that's the only element which can be selected so and here you can see the the the value we here provide as an output is that directly the payload output format and here that is uh yeah we we can say it information [Music] from from the http in get okay deploy it so ah yeah big letters yeah so so i can see here tab and so on okay um that's given now and now we can invoke it once more let's see what happens here as you can see that's provided that was in uh given here now here in the payload so um that was this get but if you want to trigger something maybe uh what also could be if you say ah i want to start from my from when you do some uh when you win when it's a raspberry pi and you provide here an external endpoint yeah to your own network and that's not on the on um yeah so an example what i'm running here on directly on the internet within the ibm cloud maybe you want to trigger something yeah so that is also possible to do that uh with that then it's possible to do that with a post for example you have to want to do something you get something concrete information what you may be to want to start yeah so and uh we going to now uh to select an http in node here so let me see also here i want to say here let me make it very clear command that this was just using http in with get so that was that so everyone can see that we create also a new debug node so that debug node is here so we switch that off and um then we can directly copy paste and say here with closed so maybe that's nice okay so now we need to configure that here now we have here a post and uh we call it here start zero two that's our this represents our post in a moment so that we have at the moment we have um two end points we have the this endpoint and that endpoint and uh now to make it right we provide here the http response oh that's the http response yeah so and um when we now invoke want to invoke that it's not uh normally used to do this inside and know inside a web page you can see here like that because that's normally gets what you what you what you do here joe yeah cancer content not because that's a get yeah you can see that's get and uh we're doing sending a post that's the post endpoint so okay what we need to do we need to do that with postman for example yeah i uh make it bigger so few zoom in also out no so many so in and zoom in i guess now i would say zoom in no it's too big i cannot see anything anymore ah going back zoom out okay i think that that that's that's okay now i create a new request and i say here that's here uh http in post so and uh for sure it's a post and it should be and we should invoke it as opposed uh we can use that directly i can just copy that here and put it here so and we can send it and currently yeah it is okay but yeah we can also take a look here in the in the debug window i'll go back here debug window back messages clear all once again you send it yeah nothing happens because we haven't provided anything so with that is with a post going here um uh we can provide now something in the body so and here we use the raw data and we say here we provide it in the json format so like we did it before so and i would now so i call it [Music] now when i put it here call it a command and i say here my command is for example start post yeah that's that is my my simple command here and i sanded and you can see it's here so now we can also create here um a new another switch it was text so text now we can do the same what we did before with the hd with the http in and with the get yeah you know but here we uh adding we're adding additional information that you get any any response at the moment yeah we we do not expect we also expect for the confirmation yeah we can also create some confirmation information here in addition in the payload yeah your message was well received or something like that but at the moment yeah that that is not needed for us and now we can directly put that here and now and that is what we can now do in addition now we create uh not uh i would say that's the easiest thing when we when when we go to layout that that we say here we create here inside our stream information a new group and we call that group um [Music] the post post for the http yeah so okay and now you can select it you can see here post okay and we give it also here or we reflect the name information from the http in in host done okay so going back to our happy streaming we see it here so still that information is given and now we can send this once more and you can see a command start post um yeah we could also stop from here but i i guess you the rest uh you are knowing yeah when you did already some i guess you're a little bit you are doing with a node red and that's then familiar for you for you then um you can also um extract information because now we have uh this information we can take a look here in in which format is this information given we have the format or already given in um in a json object yeah so we have it here so command yeah object so that means we could here use for example um switch so and that could be that we say uh depending on the input yeah maybe uh something to start and so on and that is all that i only want to show yeah yeah for sure you can start with something then when you say here when the method now we know that is our here our command yeah and now we say if the command is really like start post yeah then we go to the ending one and we say if it is unequivocal to that we going here so and so we could say here if it is equal to that it should be here so then we need to remove that and we can also create a new text that could be in the same for the post but we say here not uh not uh that command for example yeah what divided command going here and if it is a not valid uh command yeah we can also add some to reflect that that we can add a function to modify excuse me the string so if that's uh if that's not valid but i don't want to do that now so now going back to the stream so not valid command we can see here and the other one yeah and when we going to send it yeah it is was a well it was a valid command so now let's see what happens when we send it with that so you can see it's not you can see here there's the information yeah now i feel much more comfortable it works this before it was a little bit surprising and uh okay it worked later at the end but i think that's much better for you also and for myself yeah to make that more worse how that all that stuff works and i think yeah as you have seen that is yeah it's a cool stuff working with notre dame i like you work well with greg is good also for the for the understanding and now we have also here additional uh stream yeah i put as an answer in addition to here so then to show that yeah i have nothing in addition at the moment i can say here and uh yeah i would say um thank you and uh i will end in a few moments stream here i will now i will rise up a little bit my new song i made and i say uh thank you and maybe uh we will see us in a accidentally after hours live stream or when i want to create a live stream and when you ask questions yeah it's all about uh when you ask questions that's motivating me to create such kind of streams and yeah then i would say i rise a little bit music and then i will stop the stream and i wish you ah it's friday today on my side so on this weekend and i wish you a nice weekend and um see see you ah if you like it yeah subscribe and if you like it also press like okay say bye you
Info
Channel: Thomas Südbröcker
Views: 3,723
Rating: undefined out of 5
Keywords: quarkus, rest, authentication, authorization, ibmdeveloper, multitenancy, keycloak, java, vuejs
Id: Ghqsnog1aV0
Channel Id: undefined
Length: 30min 40sec (1840 seconds)
Published: Sat Jan 15 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.