REST Intro - Build a REST Service in C# Visual Studio Part 1

Поділитися
Вставка
  • Опубліковано 27 сер 2024

КОМЕНТАРІ • 135

  • @btoz6237
    @btoz6237 7 років тому +1

    Great set of videos Jon! Nice and easy to follow, and straight to the point with real code examples. I enjoyed them all. Thank you for these.

  • @krantimadineni585
    @krantimadineni585 7 років тому

    This is one hell of a series for any one to learn the basics...I watched this whole series and it's an amazing series for beginners...lot of my doubts have been clarified in one shot.

  • @AdrianPerez-nj1or
    @AdrianPerez-nj1or 6 років тому

    Thanks A LOT Jon, I spent days searching, really digging the web, trying to find a clear, concise well explained and complete tutorial to really understand the whole thing. Many thanks for your effort, time and giveness. You really pointed me in the right direction. Thanks!

    • @telejonjensen
      @telejonjensen  6 років тому

      Hi Adrian,
      You are welcome! Thanks for watching!
      Jon

  • @frankjorissen6271
    @frankjorissen6271 8 років тому

    I would like to thank you for this very comprehensive series of tutorials of REST services.
    They have helped me a lot to get started

    • @telejonjensen
      @telejonjensen  8 років тому

      Hi Frank, thanks for the kind words!

  • @sakshock
    @sakshock 6 років тому

    This is the most elegant video on the shortest time ! Great work !

    • @telejonjensen
      @telejonjensen  6 років тому

      Hi Sakthi,
      I'm glad it was useful!
      Thanks
      Jon

  • @davidstevens6654
    @davidstevens6654 4 роки тому

    Starting my journey with Visual Studio. This helped! Thank you! Will following other postings.. Well done..

  • @rajibghosal
    @rajibghosal 6 років тому

    I have been looking for a quick overview and your videos are just the right ones. Tanks for taking the time to create these. Awesome!

    • @telejonjensen
      @telejonjensen  6 років тому

      Hi Rajob,
      Thanks for watching! Let me know if there is anything specific you are interested in.
      Thanks
      Jon

  • @sprasadik
    @sprasadik 4 роки тому

    Great Job... Thank you Jon for your effort...

  • @GaryParkin
    @GaryParkin 8 років тому

    Jon, thank you so much. I needed a refresher and never knew about Chrom's DHC. It makes it so much easier to test.
    I created it and it works perfectly.

    • @telejonjensen
      @telejonjensen  8 років тому

      You are Welcome Gary, please let me know if there are any other areas a video would be useful. Thanks!

    • @GaryParkin
      @GaryParkin 8 років тому +1

      I'm watching part 2 and hoping you go into basic authentication. It's been many moons since I had to create one of these. Database is easy. :)

    • @telejonjensen
      @telejonjensen  8 років тому

      Hi Gary, I will add that to the list.
      Thanks again - Jon

  • @waynegreen6401
    @waynegreen6401 7 років тому

    A very solid teaching performance. Easy to follow.

  • @lindsayleeds
    @lindsayleeds 7 років тому

    Thanks so much for doing this tutorial and making it available for free! I was really happy to have some code that did something in less than 10 minutes - very, very cool!

  • @brynburson4490
    @brynburson4490 5 років тому

    Thanks Jon. Very helpful. Slightly easier with the community 2017 version. I chose the WEB API option which creates an example controller. Using the chrome extension was an easy way to test. I am going to try and merge this code into my existing app.

    • @telejonjensen
      @telejonjensen  5 років тому

      Hi Bryn,
      Great, I'm glad it was useful. As soon as VS2019 release expect a new set of videos.
      Thanks for watching.
      Jon

  • @ScottGammans
    @ScottGammans 7 років тому +2

    Clear, concise, and it works. Thanks!

  • @osamahislam
    @osamahislam 6 років тому

    thanks jon, if only all videos were that easy

  • @Polar_Nerd
    @Polar_Nerd 6 років тому

    Thank you for this tutorial. Very clear and simple.

    • @telejonjensen
      @telejonjensen  6 років тому +1

      Hi,
      You are welcome. Thanks for your comments and for watching!
      Jon

  • @Guitarman01
    @Guitarman01 7 років тому

    Great tutorial and easy to understand.

  • @philpandy
    @philpandy 4 роки тому +2

    Thanks Jon, great tutorial !
    can you also show how to add a simpe authentication?
    so that any calls to the web api need to provide user & password ?

  • @weetabixhands
    @weetabixhands 6 років тому

    Thanks Jon, this was really helpful. :)

  • @ArthurDiasCaldeira
    @ArthurDiasCaldeira 7 років тому

    Thanks Jon Jensen!
    It will work fine to what I want.

  • @victorcruz2157
    @victorcruz2157 7 років тому

    Excelentes videos, Saludos desde México.

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Victor,
      Gracias! Thanks for watching!
      Jon

  • @matheuscampos9595
    @matheuscampos9595 7 років тому

    Very good! Thank you

  • @tonyriddle7646
    @tonyriddle7646 4 роки тому

    DHC chrome extension is not available....
    what is the alternative??

    • @telejonjensen
      @telejonjensen  4 роки тому

      Hi Tony,
      In later videos I switched to Postman. I really like it and use it all the time: www.postman.com/
      Jon

  • @albertpizzarello1147
    @albertpizzarello1147 4 роки тому

    Hi Jon, do you charge hourly for some tuition/help ?need some help using visual studio .net not C and struggling using rest to places like shopify

  • @to15108
    @to15108 7 років тому

    Thanks Jon. I followed above and my return set does not look exactly like yours. It is wrapped in an XML wrapper. Any way to get rid of that and make it look like yours?
    Person1
    Person2

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Tony,
      Make sure in DHC you specify JSON as the return type. WebAPI will return the data by default in XML unless you specify otherwise.
      Jon

  • @InsideTrack
    @InsideTrack 8 років тому

    I have enjoyed following your videos, however I have hit a snag. When deploying / publishing to IIS, and then browsing the website, it says something like resource not found, or path not found or something like that. I sense that while this works nicely in visual studio, its not deploy-able and that some kind of routing code needs to be written. What would I need to do? The basic get is giving this:HTTP Error 404.0 - Not Found
    The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
    What code is missing?

    • @InsideTrack
      @InsideTrack 8 років тому

      solution found something to do with my iis setup:
      Click "Start button"
      in the search box, enter "Turn windows features on or off"
      in the features window, Click: "Internet Information Services"
      Click: "World Wide Web Services"
      Click: "Application Development Features"
      Check (enable) the features. I checked all but CGI.

  • @roul3688
    @roul3688 6 років тому

    Thank you, thank you, thank you...

    • @telejonjensen
      @telejonjensen  6 років тому

      Hi ,
      You are welcome. Thanks for watching!
      Jon

  • @HaitaiNg
    @HaitaiNg 7 років тому

    @4:23 (Where you selected the ASP.NET Template) you selected "None", however you also added folders and core references form "Web API".If I created a MVC Application Template as opposed to "None", can I continue to follow this video as a tutorial?Is it possible to merge web mvc with web api?I never did web development until now, and I completed most of the front end of my. My current objective to determining how I obtain data from the servers then displaying it on my website.Thank you for your time!

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Han,
      You will need to choose if you want to do Web API or MVC. They are similar but not the same.
      Jon

  • @Vitokonuk
    @Vitokonuk 5 років тому

    Thank you.

  • @jmac2543
    @jmac2543 7 років тому

    nice intro.

  • @mmelnikov
    @mmelnikov 4 роки тому

    Hi Jon. Can you please share the source code? Thank you.

  • @wernhsp772
    @wernhsp772 7 років тому

    Hi Jon. Would this work when handling file uploads? I've followed your iOS tutorial in consuming this web service and works perfect except now I need to add image upload to the form. I've tried using base64 conversion but it seems to crop the image when saving to the database. The base64 string seems to be truncated sql server.

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Wernhs,
      You are on the right track. I would base 64 encode the file and add the resulting string to the JSON. Here is an article that may help: www.codeproject.com/Tips/757991/File-Upload-using-WCF-REST-API-and-JavaScript
      Thanks for watching and let me know what you end up doing!
      Jon

    • @wernhsp772
      @wernhsp772 7 років тому

      Hi John, I was on the right track all along. What I did was I converted the image to base64 and saved it using the web service as string. I initially thought that the DB server was truncating the image, but the whole base64 string was intact. The viewer on SQLServer Management Studio was the truncating the string (when you do a select *) since the string is 146K in size, it only shows 64K size. Thanks again.

    • @telejonjensen
      @telejonjensen  7 років тому

      Hey glad you got it working. You will have a potential timeout issue if you upload large files but this approach should be fine for smaller files. You can break it up and do multiple requests for larger files.
      Jon

  • @frozeneternity93
    @frozeneternity93 6 років тому

    I really do hope you will be able to answer this question for me. To deploy this type of project on a Windows server will I need to install ASP.NET MVC on that server? I have VS Express on there and when I deploy the project to IIS it places the files but the site doesn't work with the API.

    • @telejonjensen
      @telejonjensen  6 років тому +1

      Hi,
      This should help: www.c-sharpcorner.com/UploadFile/2b481f/how-to-host-Asp-Net-web-api-on-iis-server/
      If not let me know and I can do a video on this.
      Jon

    • @frozeneternity93
      @frozeneternity93 6 років тому

      Thank you very much for your reply.
      I was actually able to resolve this myself. It was an issue with the Identity on the IIS Application Pool and the user on the website folder.
      Now that I know this will all work on the current server setup, I will push on to part 2 of your series :)

  • @evgenykl
    @evgenykl 7 років тому

    Could you explain how to publish and consume the REST service you had built in IIS? I tried to do this using Visual Studio and I succeeded topublish it. But i don't understand how consume it. In your sample that works under IIS Express you call localhost:/api/person. When I publish the service in IIS I see many compiled files but I do not understand what address I should call to get the same result as you got in VS. Thank you

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Evgeny, if you have the service running in Visual Studio you can access it the way I did. If you want to publish it locally you would need to have IIS installed and publish to it (or to another server running IIS). This article may help: www.codeproject.com/Articles/28693/Deploying-ASP-NET-Websites-on-IIS
      Thanks for watching!
      Jon

    • @evgenykl
      @evgenykl 7 років тому

      Thank you for your answer. I have described my problem and a solution here: stackoverflow.com/questions/42766595/how-consume-rest-service-that-was-built-using-webapi-in-visual-studio-and-publis/42767966?noredirect=1#comment72657240_42767966

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Evgeny - awesome! Thanks

  • @mandarinomaracuja9112
    @mandarinomaracuja9112 7 років тому

    Nice Tutorial. But I get a "301 Moved Permanently" instead of a "200 OK". The Port and everything in the URI seems to be right (of course for my localhost, in which the IIS Express is starting the application).
    If I find a solution, I will Post it here.

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Madarino,
      Make sure you are not using https. Thanks for watching!

  • @trackerpointrfid2934
    @trackerpointrfid2934 7 років тому +1

    Jon - followed this exactly but on Debug, Start returns
    HTTP Error 403.14 - Forbidden
    The Web server is configured to not list the contents of this directory

    • @peterlorenz211
      @peterlorenz211 7 років тому

      same here...

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Cliff, Are you going against your own server or the one shown in the video? You will need to set up your own server.

    • @johnmac241
      @johnmac241 7 років тому +4

      Ignore the error. Just append the method call, ie. localhost:19885/api/Person (use the Restlet client for a nicer view)

    • @naykidape9774
      @naykidape9774 6 років тому

      Wicked, cheers dude

    • @muslehhaj4164
      @muslehhaj4164 5 років тому +2

      same case come to me , and i solve it by creating starter page "index.html" in the main project as below
      ua-cam.com/video/-gEtB53Sjs4/v-deo.html

  • @samuelcramphorn3874
    @samuelcramphorn3874 7 років тому

    Thanks!

  • @rubensguifarro1404
    @rubensguifarro1404 7 років тому

    Hi Jon!
    I have my web service running after following your videos. Around 6:16 you mentioned some mapping codes not to be covered here. I need information about that, since I'm trying to change my web service so all the methods are POST for all CRUD. Than way, I can send all of my parameters in the body of the POST and not the URL. Besides, that way I would have better ways to call the methods like: getAllPersons, getPerson, and such. What's your advice on mappings?

    • @rubensguifarro1404
      @rubensguifarro1404 7 років тому

      Jon, I figured it was as simple as adding [Route("api/person/getPerson")] before my method on the PersonController class. My method is now POST, I send the ID as a body parameter and it returns a person object. Your videos are great!

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Rubens,
      Great, I'm glad you were able to solve that.
      Thanks for watching!
      Jon

  • @kumaresha3348
    @kumaresha3348 6 років тому

    Hi Jon, I am getting "Connection must be real and open". Can u please help me how to fix the issue. I used your part 4 in connection to MySQL.

    • @telejonjensen
      @telejonjensen  6 років тому

      Hi Kumaresh,
      It sounds like you are having an issue with the database connection. I would check your database connection.
      Thanks for watching!
      Jon

  • @angelabandawuer3765
    @angelabandawuer3765 5 років тому

    Thanks for your videos, all of thew were so so so helpful, and clear. Sorry to ask. We can say that this videos show a "WebHook" behavior, Am I wrong?, is there a difference betwwen this and a WebHook?

    • @telejonjensen
      @telejonjensen  5 років тому

      Hi Angela,
      You are welcome. What do you mean by a WebHook?
      Thanks
      Jon

  • @wernhsp772
    @wernhsp772 7 років тому

    Will this REST services can be used in an iOS phone application using xCode & Swift?

    • @telejonjensen
      @telejonjensen  7 років тому

      Yes! I will see if I can work up an example for you in the next few days.

    • @wernhsp772
      @wernhsp772 7 років тому

      Thank you. Can't wait. Good video by the way.

    • @telejonjensen
      @telejonjensen  7 років тому +1

      I have an example of an iOS Swift iPhone app that will POST, PUT, GET and DELETE. It will be up in the next few days.

    • @wernhsp772
      @wernhsp772 7 років тому

      Awesome, thanks for doing this. I really appreciate your help.

    • @telejonjensen
      @telejonjensen  7 років тому

      Here is the first one covering GET. POST, PUT and DELETE coming in the next day or so.
      iOS Swift Calling GET on Azure REST Web Service

  • @davidstevens6654
    @davidstevens6654 4 роки тому

    HI Jon, Is the Code available...?

    • @telejonjensen
      @telejonjensen  4 роки тому

      Hi David,
      I'm working on getting on Github.
      Jon

  • @xaviershowrn462
    @xaviershowrn462 7 років тому

    When i create a new api project, i can't add folders "web API". Do you know the reason? Thanks!!

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Xavier,
      What specific steps are you trying to do?
      Jon

    • @xaviershowrn462
      @xaviershowrn462 7 років тому

      4.20, when you create your project.
      I can't choose "add folders and core..." -> "web api"
      I have visual studio 2017
      Thx for your help

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Xavier,
      I suspect you are missing something when you set up Visual Studio. I will post a short video showing which options you should have.
      Jon

    • @xaviershowrn462
      @xaviershowrn462 7 років тому

      Alright, thx for all

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Xavier,
      The video is up on configuring Visual Studio 2017. Let me know if you still have a problem after configuring.
      Jon

  • @TJKwon000
    @TJKwon000 7 років тому

    You did this in Visual Studio 2015. Can you do the same in 2012?

  • @rishabhsingh3610
    @rishabhsingh3610 6 років тому

    I tried to run the controller as it is, and whenever I try making a request it returns the following 404 error
    {
    "Message": "No HTTP resource was found that matches the request URI 'localhost:11892/Api/User/'.",
    "MessageDetail": "No type was found that matches the controller named 'User'."
    }

    • @telejonjensen
      @telejonjensen  6 років тому

      Hi,
      Do you have a controller that looks like this:
      public class UserController : ApiController
      Please let me know.
      Thanks for watching...
      Jon

    • @rishabhsingh3610
      @rishabhsingh3610 6 років тому

      Hello Jon,
      Thanks so much for the quick reply I fixed the problem! I had not named it UserController, but rather User! Simple Mistake! However, I have continued on in your series and have come across another problem. When trying to connect to the mysql database I recieve an id of 0. Can you please help me? Thanks so much for replying!

    • @telejonjensen
      @telejonjensen  6 років тому

      Hi Rishabhm,
      Do you mean the data you get back has an ID of 0? Did you set the field to auto increment? This may help: www.w3schools.com/sql/sql_autoincrement.asp
      Jon

    • @rishabhsingh3610
      @rishabhsingh3610 6 років тому

      Hi Jon,
      Yes it has an ID of 0, but it is not being shown on the MySql table (this was probably expected), I have set the column as auto increment and I will check the resource you provided.Additionally, the column is automatically set as a key and a not null field. Thanks again for replying (not many people do that)!

  • @coopertichenor3528
    @coopertichenor3528 6 років тому

    Getting a 403.14 error after running?

    • @telejonjensen
      @telejonjensen  6 років тому

      Hi Cooper,
      Were you able to resolve this?
      Thanks for watching.
      Jon

  • @michaelgorgone4269
    @michaelgorgone4269 7 років тому

    Hi Jon, thanks for the great tutorial I'm having a "404" issue though that maybe you can guide me in the right direction to fix it. I'm using VS 2015 Community. I set up the Solution like you mentioned and got that "HTTP Error 403.14 - Forbidden" error. I added a "default.html" page and set it as the startup page and running in Debug mode brought that page up w/o any problem.
    However when I updated the URL to the WS URL... "/api/" I got a "404" error (same error in the Restlet client).
    Any thoughts as to what might be going on? From what I can tell I have everything setup the same way your tutorial has instructed me to.
    Thanks in advance for your help!
    Mike

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Mike,
      This sounds like an issue with the resource name you are requesting. A 404 indicates that the client can connect to the server but the server does not have the resource being requested. Make sure you didn't rename anything after you first created your controller and then take a look at the comments that are generated to make sure you are using the correct name.
      ///
      /// Get all persons
      ///
      ///
      // GET: api/Person
      Note here it shows you what the resource name is.
      If you can't solve it and want me to look at it, you can email it to me and I will take a look.
      Thanks for watching!
      Jon

    • @michaelgorgone4269
      @michaelgorgone4269 7 років тому

      Thanks Jon for the reply Jon. I looked through the main file and it looks like everything is named consistently and I copied and appended the "api/DTGWS1" string into the localhost url but still got the 404. Is there a preferred email address I could send the zipped up solution to?
      Thanks again for the help!
      Cheers,
      Mike

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Michael,
      You can send it to jjdevry@gmail.com. I'll take a look.
      Jon

    • @telejonjensen
      @telejonjensen  7 років тому +1

      Hi all,
      Resolution on this was to make sure the controller class name ends with Controller - like MySuperController.
      Jon

    • @michaelgorgone4269
      @michaelgorgone4269 7 років тому

      Yes and thank you Jon for the help. I'm moving through the rest of the tutorials and everything is working.
      Getting my webservices on!

  • @michaelgall5120
    @michaelgall5120 7 років тому

    Great video series (much appreciated)! Where can I download a copy of the source code (so I don't have to type it all in from scratch)? Thanks.

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Michael,
      If you register here (for free) you will have access to the source code. I'm working on just putting it up on GitHub as well.
      Thanks for watching!
      Jon

    • @paulgrandjouan3777
      @paulgrandjouan3777 6 років тому

      Why the need to download the source code here? Isn´t all the code written by Visual?
      (apart from the slight modifications (value -> person))

  • @SupunNimantha
    @SupunNimantha 7 років тому

    appreciate

  • @shellphil5439
    @shellphil5439 6 років тому

    Could you do a new video where you show us how to add a second controller? Expanding the API server :)

    • @telejonjensen
      @telejonjensen  6 років тому

      Hi Dj,
      Sure, I'd be happy to. Thanks for watching!
      Jon

  • @victorcruz2157
    @victorcruz2157 7 років тому

    Que tal Jon. Te envió un cordial saludo y aprovecho para preguntarte si vas hacer algún curso sobre WCF. Gracias!!

    • @telejonjensen
      @telejonjensen  7 років тому

      Hola Victor,
      Todavia, no. Estoy pensando en hacer uno in el futuro.
      Muchas gracias por ver el video.
      Jon

    • @AdrianPerez-nj1or
      @AdrianPerez-nj1or 6 років тому

      ¿¡O sea que hablas español Jon!?, ... jaja... y yo que te dejé mi mensaje en inglés. Pues ahora en españo. ¡Muchísimas gracias por este tutorial!

  • @CesarGutierrezOlmos1612
    @CesarGutierrezOlmos1612 7 років тому

    a mi me sale xml Soap y no REST???

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Cesar,
      Thanks for watching. These videos are focused on REST using JSON. I may do some using XML and REST in the future.
      Jon

  • @bizarreworld2002
    @bizarreworld2002 7 років тому

    Hi Jon, excellent tutorial! Can we download the source code from somewhere?

    • @telejonjensen
      @telejonjensen  7 років тому +2

      Hi,
      Yes, I'm working on a way to have it accessible.
      Thanks for watching!
      Jon

    • @bizarreworld2002
      @bizarreworld2002 7 років тому

      Thank you!

  • @michaelgall5120
    @michaelgall5120 7 років тому

    Can you please provide a LINK to the source code once it is available? Thanks.

    • @telejonjensen
      @telejonjensen  7 років тому

      Hi Michael,
      I've posted it on fiveminuteprogrammer.com.
      Let me know if you have any problems accessing it. I am also working on posting it on GitHub.
      Jon

  • @ssinfod
    @ssinfod 6 років тому

    Hello Jon, very nice tutorial! Can I download the source code from somewhere?

    • @telejonjensen
      @telejonjensen  6 років тому

      Hi,
      Thanks for watching, I'm working on a place for the source code.
      Jon

  • @philippedesrochers7589
    @philippedesrochers7589 6 років тому

    Hello Jon, is it possible to post the projets on github ? (otherwise do you give me the permission to do it?)

    • @telejonjensen
      @telejonjensen  6 років тому

      Hi Philippe, Yes it will be up shortly.
      Thanks for watching!
      Jon

  • @TravellerNg
    @TravellerNg 5 років тому

    Hey Jon, Do you have a Skype or an email? I need a little help regarding sending the authentication token as a header to the server. Since I'm only getting back 401 unauthorized error.

    • @telejonjensen
      @telejonjensen  5 років тому

      Hi, please check out: ua-cam.com/video/UksI-hKCNYs/v-deo.html
      That should help.
      Jon

  • @leonardpera3214
    @leonardpera3214 6 років тому

    Hello, can this be done with VS 2012?

    • @telejonjensen
      @telejonjensen  6 років тому +1

      Hi Leonard,
      I have not tried them in 2012. At one point you could do WebAPI in 2012 but I don't know if Microsoft kept the new versions of WebAPI current with the older versions of Visual Studio 2012. THis may help: code.msdn.microsoft.com/ASPNET-Web-API-JavaScript-d0d64dd7
      You may want to consider moving to a newer version of Visual Studio. The Community versions are free and will allow you to do all of this. Here is a link: www.visualstudio.com/vs/community/
      I hope that helps and thanks for watching!
      Jon

    • @leonardpera3214
      @leonardpera3214 6 років тому

      Jon Jensen Hi, I've managed to go on with the tutorial on VS2012, so far so good, thank you for the reply :)