.NetCore Winforms (Desktop application) - Consuming Restful API Services - Step By Step

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Here I am going to teach how to perform curve operations using nice Philippi services in his pyramid Corwin forms so I am able to do it all you can see get on so I'm able to cater status of all the AP calls and if I want Pacific to any particular data I can mention here one and I can get that particular record only also I'm returning what is the status code is returning Portland will be in same status for I am using because gate methyls it will return to order ok status and I want to use post method so here I am going to do for example to be repaired so located a mediator and they sell most so do not want this creator you can see that as creator successfully if I want to update and can use update suggestion will put method 200 okay status is updated and if I but all I want to delete this ID so general put ID 1 + delete so I deleted returning the status code to not for now we can see how to implement same scenario step by set so easy step-by-step the first time this is my existing project here I'm going to add one more from here the form name I will use call APRs play whatever you want you can commit time you call a PA and giving them for me and so my existing application I added the new form that it's going to create into them and other forms folder so it's creative so I will go to the program that cs5 and I will say the t4 before you should have to call the Kali page so just I'm updating here car people that's it so I will go to the forum view here I'm selecting the button go to properties and I'll select the earth 12 you click OK to change this button names and size who is me my work you PTM Kate you in here - always co2 use proper naming convention that is good practice Oh you okay are they done now we will write for the core so W click here get on Thea we need to get ap I said ugly so we are going to consume them I cut from the AP so bothered be needy AP so right now I am NOT going to teach how to create the APA those things are not so just time I will teach how to consume the APA on our windows forms that is that hasn't of this video so for that we need some a peonage some AP response we need some vehicle to be to be there I am going to take the dummy AP dummy payments of a KP I am going to take so if you'll go to the browser you can just browse it dummy UPA you get ele the vehicle former right now I hand going to use from website that it will provide the dummy a pin so just on HTTP years are you are you are years because response da ting so this APA this application I'm going to use further consuming the dummy a piece so there may be nothing much fake fake data it will do that ignites at espalda de fake dinner see here we have the requester request unresponsive you will see this stuff a user we're going to list this many data set a single user it will do that this monitor a single data at YouTube and so the so here I'm going to take get list of the user I will use it a shake it on and get I'm going to use it as a ate method here and I am going to use a post method book method and finally tell you who code operation I am going to use using this P Thank You P okay for that I need a a period this is the URL just you can copy the URL copy link address I'm going to create some helper class here for that I will have the folder called shared here if you want to use folder are you know need to use for up to you so just I create one helper class I will name it as list help I'm good so one class what happened in the clear I call it as here Western per year so that I am going to use Oh static mr. for I'm going to create here I am going to create a method to return the response per click you standing a sink does get out you you you here I'm going to use HTTP played see by default is typical and it will throw the error also Yahoo insert using system dotnet dot HTTP just included and don't get the soup so here I'm going to use this base URL is your plus followed by I'm going to the website I want a list of the user so I need to get what is the users so just I will copy this URL you can eat what you are getting here and page number two you will get all the data if I am NOT passing page number what it will they're getting this so I'm going to use this is the my response so and just copy this user here and I will add it here so that means he s class uses your gate here so you are getting the response from the response I need to take the content so here yes so I'm going to take that content here theme content I ought to read assisting I need to use string data we preferred don't until taught read as a stringer sing this method will read the content stream content from the response so failure we turn because is expecting the task of the results or task and he goes on first so threatening it will resolve the task here and before reading here we need to use our right he were to V this because this is a synchronized cuz that's why we need to use a white here and I am going to return this string if eight caper I want to return this string so I am going to return in turn data okay still we are getting issue in case if nothing is happening we just I want to return the empty string [Music] that's it I done the AP calls here helper class decorated guitar method this method I am going to use it in our form so yes I will open my form here premier so guitar method is there here i'm going to call that helper class here so I created method named twist a little is a class name I created and / yes we solve it so it will ask me using share I got it dot return so these get all method it will get the other record from the EP but I need to assign these valuable to my a response a response nothing but I need to store it in that value this rich text boss I want to show the response from so what I am going to do is I will use I will read this response first equal to our white because we are using a synchronous method that's why I'm using a white here if I'm using our way you need to make the consumer method also synchronize so yes sync so I'm able to read the message and I am able to store this message into one variable after that yes I am going to pass this text into them and JSON string into the my research txt response the dot txt the equal to what are the response I am getting from the typical I am going to possible and okay so it will arrange it now I will test what is happening okay and put a point here yes I will go to the forum I will hit the get all method I'm pressing f11 here I can navigate into the application so BSU are all already declared here you can see now I am going step by step here so HTML HTTP client is in sliced and so request is called we got the status code 200 here and okay and same I am reading from the response from the content and I'm reading a sin beta so I am able to see the actual JSON stream here so same thing I am going to return here so I got the response here same respond I am going to pass filter minder which takes part now I will just hit continue here you can see the data here from the EP what of the data anything you can able to see as a response into the witch a spot but if you noticed here the format because it's a JSON string that's it just a string but we are not formatting here because as per the real scenario we won't get any formatted string but if you are seeing here in website website also beer we cut like that only this is not formatted but if you are seeing here it will be pretty fine so there you see the prettiest to show the proper JSON format as if 55 so we can also make it bad if you want in Windows applications we want to make it fit inside we can make it work it will make one fit if I hear this DSR and further we will continue further taming the existing ill per class I am going to use predefined beautify yes you string quintet understand and my name is a I beautify J so I'm using this method to beautify I'm going to get parameter is string response it is mystery edition giving messages on the scale here and here I'm going to use first I need to pass that system resume that is JSON string are not going to pass that first forum for that I'm going to use Tito J token is here plug in we need a Newton sock for that purchased I'm going to install neutral soft in year 2019 hours you can from here only you can with on navigating into it all no gate manager we can install it everything from here only yes I'm going to hit this button it will install the Newton song for us to take some time install and it will cover it here is reffered now if you got resolved now I'm going to use bonus she is some thinking me off what we've been using we are not using any initialization here on dot cost method and what you use here what all that is something I'm getting same string and good book pass it here so I passed them in JSON Union and these days I am going to beautifully so HSN use return Whittle this first JSON god to stream here I am going to use for making or meeting . so click record geez Newton's of JSON just select that now the formatting it will be resolved there will to use Kingdom so now this table was validating whether this is JSON string or not after that dish of the validation welded him well the validation I am going to convert a searches on intent here so is more method is now fine now I am going to use that method instead of response I will used here same risk Alpert we worked out good wages you that's it so we'll now we see the same response how it will work I'm not going to debug now is it you you I hate see data is formatted yes I will stop it you you we got the EPA and I was textures permitted successfully per class again so cool I copied this number and first can stop guitar I will make Kate and I will fascist so here I want to use getting the single response patient ID again I will go to the website to get a single response this is the format so users class you need to pause the ID whatever the ID unity use so I'm going to use your class and thus for all the Heidi so so just hiding idea or map ending here and again one more method i will copy here control speed that ctrl-v so here I am going to use you post all year I need to field very going to the website again but most what and all we need most we need name on job to parameters we need so I believe will to three a two parameters for yes one is able to use being other one is job and I'm using here first comes to data means I need to use it first I think instead of a dozen hostessing and hostessing you can see the URL what is the URL we are using still user only and we are passing as a JSON content us in our input here so you need to consider this we need to process a JSON content here so what are you going to do this is not required now because how are you are is correct I'm going to use this one only but see here we need two parameters here forces think you feel soon we need a HTTP content intent nothing but ill palm data or JSON string whatever we have possible so what I am going to do I am going to create a JSON content first so I will just copy these I want to he was this is a input to the APA so what I will do I will declare data are given a massive rotater equal to you of dictionary quiet because we are we will use as a key and value pan here so I'm going to use string [Music] that's it so here I'm going to use this whistle Ian value Here I am going to use the parameter I am getting that I'm going to use should not hardcore the venue and I'm going to use job and control so this is my input so I need to make this input ASEA content HTTP country so for that what I will use I can able to clear one more variable input I'm going to convert that your you um you are in coral contact here I am going to pass this imitator so automatically these it will convert into there I used to be content this content I am going to positive here you are a same hostessing contact so I am able to pass it here points is fast I will I will get the respond based on the response whatever the response is coming I am reading as a string again and I am going to throw this post method that will check how is working we will implement this post method so for that again I will go to the designer view here for the post method is double click here so just copy what over there for just a split here instead of gate I am going to use power here we need two parameters one string name and job so we already created the two text boxes here one is if you are seeing here this is txt name other one is the exceed job this I'm going to use it here so ext name dot text txt your god so I'm going to pass that into the this method see I am getting the issue away because we need to converter say a sink here beat this method because we are using a synchronized card so I'm changing here yes synchronous call so we get out the hearer get out of the error now I will run the application so post matter is very here and here I'm going to use a little array the yellow and job this is the team years of engineer and in the bottom see creator net so creator and Haile is creator and yes a name so successfully executed okay so post method is working fine now I need to integrate this kid but it's all just a little change here I think yes and I will copy the same ketone error chain too it here we need one parameter we need to pass the ID so we'll go here you can see this is the text box highly text box txt ID is the name I'm going to use this name here sixteen go welcome yes now I'll leave the button time button again see here get all it will get the all wake up from the EPA and if I want to physically one record I want for example I want ID number two just five select ID number two and I need I will get the ID number two and if I want to insert some records I can give any experience and I post the records - we got the we completed gate get stuff and posters and I am going to do not put and delete severely is similar we just go to again helper class I am going to create those blockers helper methods just I will copy this post content here but we can swap or strangle me Oh see before that we will go for the put method what and all the responses we need to past so we need to pass three things we need to consider one is whatever the user I am going to update that user ID I need to pass it in from the URL and what and our data I'm going to update those things I need to positive so that means we are to think it and post both APA things we need to sing for the gate I do use this ID so I will take this string learn through three parameters pick for the port you for the gate what we are using actually we are using this some copying things I don't see and paste it to your and the input Idol could get it from the name and the same input and using for people so everything done sale and here is the post and to a purpose focusing down and I will implement those things into the form so just use put here for the post whatever I'm using same thing I'm going to use here just copy paste ctrl C don't reveal one more additionally we need to pass that highly which idea I'm going to if if I'm changing put here then I need to make everything I suppose everything done now I'm going to get application see get all this working so I want to pitch a color you want object for example I will put two is I am on top yet but this is the format is different don't worry because this is the fake response I already said that fake APA we create a fake response so yes sir we want to see how we are able to consume on the how we are able to eat they eat that's it I'm going to give some text are you going to cocktail and poop so this updated so updated data to pick up the food response is working same way to eat I want to use for the delete it would return any content it will return an empty one key but anyway we will do that those things also so I will go to the designer here and so here I'm going to use one more thing because here I'm not going to use the poster sorry helper class some people eat Odell per class how we can write people might make mind how the town those things how are we total per class I can write it so what I will do I am not using helper class here there again we write it here only for the David method only so whatever the things if we have just I'm going to copy anyway I will copy this good material companies and I will go here here let me create one in shop static I'm not using static I will use public to waive it a public also doesn't matter you can use it public answer no problem now you know to resolve the things thirty mini HTTP let me need and base URL yes your will be know already yes you're now right now I will hardcore the base URL I will go to the delimiter what is it you are just copy the URL copy the link others and I'm going to add it here this is not record in step two is to it we're going to come from the ID that's why I did it and that true - instead of that intimately we can pass the water whatever the value vania here in some theaters Inc I am going to make it sink and I will change the method name delete that's it fine we told it for class as well you cannot chew this if you want some message what is the status code if I want to do a mainly operation what is the status code I you get those things if you want to wander means you can use here message box oh sure here if you want to what is the status cool you want ah yes start status quo so this response - at a school you will give and the message balls it will have some - string on this one the change to string so instead is called you okay - honest a status code using well this may be what is a status code is written you can see there if you want and then this is completely optional okay and I'm going to run this application beforehand I need to use this method so what I am going to use same things I will just copy paste it here ctrl-c ctrl-v we stopped mr. Pillai will directly very little here around I use I think I think what is the problem you you yeah you to pass only one parameter because we created only one parameter so that's it into the sound here one thing you want to know that these delete method it won't return any message so it will you my you wicket empty message only so anyways we will run and we'll show what is happening I will go here run the hit the run button oh this important about this week also idea is there right no here I'm going to hit the bottom see low content or content Musa there is no record that is a little successful [Music] so yeah see you can't pass thirsting because is returning is the empty string sorry beautiful we know if you lose this method because we're using beautified beautifully I mean here for the delete function you will end up with there it shows because you delete method if you won't return anything so I am not using this beautiful here for the derivatives so that it will solve your problem and you want to see exact status code also what is the status book because you are seeing only message I want to see the exhaust status code against this you are to put one in because this is enum value and I'm going to return the what is a status code but this action yes and you want a message also just add it here as apartment in the city and whatever we are getting the students it is gorgeous possible so same intensity you get message first so this is completely optional this line of code if you want to see more assistant is poor and missile based on the status code if you want to do so much and are some operations you need to do are some validations you need to know that time it will be mainly used to put the status quo or you want to use you want to use before the pieces he into then only blue so see in detail when you are as you can sources to you and appointee farm so just I will this application it dr. Agard and I didn't see Porter for that assistant exported I've only done for 200 series princess active but get metal and all it will return 200 assistant export and the post method it will pretend to not wanna say status code and give method to Newton do not okay you got deleted no response thank you guys I completed I hope I covered all the topics related to consuming the vapor phase and if you have any doubts of curries feel free to comment
Info
Channel: Vetrivel D
Views: 49,482
Rating: undefined out of 5
Keywords: asp.net core, asp.net core for beginners, asp.net core winforms, dotnet core winforms designer, dotnet core 3 winforms, crud, rest, restfull api, winforms with rest, winforms crud, winforms call post, winforms get method, desktop post, desktop get method, .net core winforms designer, winform .net core, desktop application, winform .net core 3, c# winforms, DotNetCore, .net core 3.0 visual studio 2019
Id: J2WaRsV0xpA
Channel Id: undefined
Length: 43min 28sec (2608 seconds)
Published: Fri Dec 13 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.