How to Create a Web API with ASP.NET CORE and .NET 6 (c# for beginners)

Поделиться
HTML-код
  • Опубликовано: 4 фев 2025

Комментарии • 141

  • @eq2home
    @eq2home 2 года назад +9

    Pat, your clarity, exactness, compactness, and delivery are greatly appreciated. Many explanations shot too high or too low, but you've perfectly threaded the knell. Cheers and thanks.

  • @skipton_
    @skipton_ 2 года назад +28

    This is one of the best tutorials I've ever seen. I've been trying to find a clear explanation of this for a long time, and this is hands down the best I've ever seen. Clear explanation of every line, file, and concept. Excellent job.

    • @prashantmjalskar8198
      @prashantmjalskar8198 2 года назад

      can you tell me how do we get this connection string? 13:21

    • @nerdintech
      @nerdintech Год назад

      @@prashantmjalskar8198 you got open your SQL Server . Then in properties you can find. Just make sure, If you're using Windows Authentication put this "Integrated Security=SSPI -For no user and password
      Encrypt=false - for no authentication" in your connection string. I hope this can help you!

  • @DataBeach
    @DataBeach Год назад

    The best I've come across on the topic. Easy, direct, clear, rich and devoid of unnecessary noise or showoff. The delivery is elegant. I feel more confident after watching this. Thanks a lot, Pat, for sharing this.

  • @oliverperez1419
    @oliverperez1419 Год назад

    I never even leave comments, but your way of breaking down every step and explaining in a concise way requires me to at least say thank you for such great content! Thanks man!

  • @asdfasd95
    @asdfasd95 2 года назад +12

    If anybody is wondering, Package Manager Console is NOT available for Visual Studio on Mac. Took me only an hour and a half to find that 👍
    Great tutorial! Thanks for making this :)

    • @drfalcoew8939
      @drfalcoew8939 2 года назад

      Thanks for the heads up

    • @louielee3583
      @louielee3583 2 года назад

      Thanks man, mind to tell us how you complete the steps without Package Manager Console?

    • @osmelteran3229
      @osmelteran3229 2 года назад

      Can you tell us how you complete the steps without Package Manager Console? Im running in same issue. Thanks

  • @luisgonzalez8877
    @luisgonzalez8877 Год назад

    The simplicity of this tutorial showed me you have a lot of experience working with this technology and frameworks. ❤

  • @kundurrudresh3541
    @kundurrudresh3541 2 года назад +1

    The BEST API Tutorial I have ever seen. Thanks Pat, your explanation is pretty straight forward and simple to understand. 👍

  • @Fred_Edx
    @Fred_Edx 2 года назад +1

    Truly a simplified explanation. I smiled almost throughout the study process.

  • @SiaD777
    @SiaD777 2 года назад +18

    Tutorial was going so well until 13:20 (thank you!) but when you copied the SQL connection string there was no explanation as to where it came from or how to build it ourselves. Any chance of some clarification in a pinned comment please?
    **UPDATE** thanks to Bảo Trần Quốc for this: "Server=localhost\\SQLEXPRESS;Database=master;Trusted_Connection=True;"

    • @Tcgmaster808
      @Tcgmaster808 2 года назад +1

      thanksss saved me there

    • @jabulanimashia6778
      @jabulanimashia6778 Год назад +1

      this worked for me, thank you :)
      "Server=DESKTOP-ST292FS\\MSSQLSERVER01;Database=IssueDB;Trusted_Connection=True;TrustServerCertificate=True"

    • @ShamelessAddiction
      @ShamelessAddiction Год назад +1

      I am getting a network error when i update the database..

  • @vascogungui2453
    @vascogungui2453 Год назад

    Finally I made my first working version of RestFul API.
    Thanks to You... Amazing explanation... Subscribing to the channel right now!

  • @EricT43
    @EricT43 2 года назад +1

    Fantastic tutorial, thanks! I was able to get my first C# API up and running easily with this information.

  • @ryanbrown7471
    @ryanbrown7471 2 года назад +1

    Awesome tutorial! Sometimes you find someone that breaks things down in a way that's easy to just grasp and run with. Took some digging to find this though so hopefully it gets to the top of the ranks eventually.

  • @RaminBohlouli
    @RaminBohlouli 9 месяцев назад

    You are amazing. Absolutely enjoyed watching your tutorial and it was very informative. You've got yourself a new subscriber

  • @tranhuuang7232
    @tranhuuang7232 2 года назад

    I love the way this guy creates tutorial. It's somehow really easy to follow along.

  • @NtsakoShilubane
    @NtsakoShilubane Год назад

    Your Teaching is Clear. You just earned a new subscriber

  • @reznov00
    @reznov00 2 года назад

    I have stumbled upon a gold mine! Thank you so much Pat!

  • @jaatharsh
    @jaatharsh 10 месяцев назад

    this is awesome, really appreciate it mate, plz keep uploading

  • @shangeet
    @shangeet 2 года назад

    This is very useful and precise explanation.
    No time wastage, complete and to-the-point. Thank you for your efforts.

  • @LuisHernandez-ev5ho
    @LuisHernandez-ev5ho Год назад

    Even though this video has a lot of "issues", is still a good one!👌

  • @Tcgmaster808
    @Tcgmaster808 2 года назад

    thank you for explaining everything !! will come back to this

  • @maryamblri
    @maryamblri 2 года назад

    This tutorial is awesome. very clear and informative. I got whatever I needed in your 33 minutes of your tutorial.

  • @dungle-wh9td
    @dungle-wh9td 2 года назад

    Charming TechWithPat always love his tutorials. Appreciate!

  • @marinosanagnostou8116
    @marinosanagnostou8116 2 года назад +1

    Very Good Tutorial for Web Api .NET 6.0
    Thank you.

  • @Brazil19900
    @Brazil19900 2 года назад

    Must say that you are great at explaining this in detail while keeping it simple! Great work and thanks

  • @lcppb
    @lcppb 2 года назад

    Parabens...Brasil na área.....até agora o MELHOR VÍDEO disponível com todos os processos do ZERO ao HERO. GRATIDÃO!!!

  • @gsr4535
    @gsr4535 Год назад

    Thanks my friend, your video helped me. I only wish your project to consume the API was a MVC Core web app! Nevertheless, thank you! 👍

  • @vijethakannaiah2917
    @vijethakannaiah2917 Год назад

    Very nice tutorial. Informative. Very clearly explained

  • @DanielFrankDK
    @DanielFrankDK 2 года назад +3

    Hey, thanks for this. 13:50 can I ask whether it's safe to use an existing database with existing content when doing the migration? I want to make an API with my existing data, rather than create a new database. Is this possible?

  • @Navin_NKumar
    @Navin_NKumar Год назад

    Nice explaining Pat. Thanks . Appreciate it.

  • @ДимаУсенков-б2р
    @ДимаУсенков-б2р 2 года назад

    Well done man. You're a great teacher. Keep up the good work.

  • @Tech-SavvyPro
    @Tech-SavvyPro Год назад

    Good one

  • @cindysloan177
    @cindysloan177 Год назад

    I think I love you. Was lost but not I'm found. Thank you!

  • @whoswasp
    @whoswasp 2 года назад +7

    at 13:20 what should I add as text? I'm not sure I followed this step

    • @timothybasalo4038
      @timothybasalo4038 2 года назад

      if you are all wondering regarding on connection strings at 13:10 if you are using Visual Studio, go to 'View' click 'Properties Window' then on the side you will see a tab.. then on 'General' category you will see Connection String

    • @maros372
      @maros372 8 месяцев назад

      @@timothybasalo4038 it doesnt show anyrhing can u give me some more info

  • @muhammadshidiqandinaaris9803
    @muhammadshidiqandinaaris9803 2 года назад

    Thank's for this amazing tutorial

  • @InfoIndus
    @InfoIndus 2 года назад

    very clear explanations, thank you

  • @thomascayne
    @thomascayne 2 года назад

    This is a great tutorial. Thank you. Just a thought why one would create a api THEN add an app IN the backend?

  • @oluja1314
    @oluja1314 2 года назад +2

    Thanks, great video.
    If you are getting this error while trying POST
    "---> Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot insert explicit value for identity column in table 'Issues' when IDENTITY_INSERT is set to OFF."
    Don't give an id to that data.

  • @afornesg
    @afornesg 2 года назад +1

    Good Video, Thanks !!

  • @djonathanoliveira3188
    @djonathanoliveira3188 2 года назад +6

    Where can I find my SQLServer path like you did at 13:21 ?

    • @nurzhakhan
      @nurzhakhan 2 года назад +1

      Have you find it? I also have same problem.

    • @drfalcoew8939
      @drfalcoew8939 2 года назад +1

      @Djonathon Oliveira Create a database on something like MS Azure, then under Connection strings, it should be generated for you. I think the guy in the video has a local database, which is why the source says his computer ID.

  • @JustinSimon-b9w
    @JustinSimon-b9w Год назад

    how are we suppossed to get the same connection string and where did u get it from?

  • @seorangpendosaaaaa
    @seorangpendosaaaaa 2 года назад

    this is a great tutorial. Thank u

  • @komanghadiwijaya6253
    @komanghadiwijaya6253 Год назад

    Thanks for the tutorial..

  • @stonedcodingtom9097
    @stonedcodingtom9097 2 года назад

    Nice to see more videos like that

  • @infodsagar
    @infodsagar 2 года назад

    Good stuff 🎉

  • @brittanymelton8043
    @brittanymelton8043 2 года назад +6

    how do you get the connection string?

    • @Tcgmaster808
      @Tcgmaster808 2 года назад

      use this bro
      Server=localhost\\SQLEXPRESS;Database=master;Trusted_Connection=True;

    • @stephanieezat-panah7750
      @stephanieezat-panah7750 2 года назад

      @@Tcgmaster808 but, we need to install SQL Express. that was not explained, I think

  • @dasmaffin1633
    @dasmaffin1633 Год назад

    Did you make another video where you showed how you set up the database too?

  • @learner8084
    @learner8084 2 года назад +1

    I don't understand why we need to put the id in the header and also the body. What is the purpose ? Could we not put either in the header or the body ? Thanks.

  • @tambuidev
    @tambuidev Год назад

    13:17 - "...and then draw the rest of the owl!" 🤨 It would be nice to know where you got the SqlServer string from. Am I supposed to already have some sort of Sql Server instance running on my machine? Where did you download it from? How did you install and run it? I would greatly appreciate any help here.

  • @jabulanimashia6778
    @jabulanimashia6778 Год назад

    awesome 🙂 thank you

  • @karimachour7386
    @karimachour7386 2 года назад

    good tuto for beginning

  • @peterpalka7733
    @peterpalka7733 2 года назад

    Perfect tutorial. Thanks a lot :-)

  • @tranhuuang7232
    @tranhuuang7232 2 года назад

    25:20 Can I ask why you don't use _context.Issues.Update(issue); ? Are they the same or any difference between the two?

  • @noel_vi
    @noel_vi 2 года назад +1

    What a great tutorial, It really helped me a lot!
    but, is it possible to connect this to a frontend like angular, if so, I would Appreciate knowing the procedure behind it.
    Thanks.

    • @TechWithPat
      @TechWithPat  2 года назад +1

      thanks Noel, I have a video about Web Api and Angular coming soon

    • @noel_vi
      @noel_vi 2 года назад

      @@TechWithPat Thank you, I'm looking forward to it.

  • @zaidrj7374
    @zaidrj7374 Год назад

    You are amazing !!!

  • @almikurniawan5082
    @almikurniawan5082 2 года назад +2

    i'm geting an error when Update-Database, A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SNI_PN11, error: 25 - Connection string is not valid). how to solve that?

  • @SomeBody-bk5op
    @SomeBody-bk5op 2 года назад

    Awesome!

  • @imikhan83
    @imikhan83 3 года назад

    Thank you, learnt new things.

  • @davidemmanuel3001
    @davidemmanuel3001 2 года назад +1

    Does dotnet 6 follow the same process of repository pattern like dotnet 5?

  • @aisha8601
    @aisha8601 2 года назад

    Hi, Thank you very much for the tutorial!
    I have one question which is how do i find my sql server's id for a macbook air user?

  • @CAPS_AMERICA
    @CAPS_AMERICA 2 года назад +2

    Hi Pat, wonderful tutorial! Do you have videos on consuming web APIs that has authentication, both basic and JWT? Thanks

    • @TechWithPat
      @TechWithPat  2 года назад

      ruclips.net/video/LZJvdFDCKxM/видео.html

    • @rajansharma7407
      @rajansharma7407 2 года назад +2

      can u help me...i am unable to create connection string

  • @2005Azm
    @2005Azm 3 года назад

    Wonderful! Thank you Pat!

    • @rajansharma7407
      @rajansharma7407 2 года назад

      Hlo sir can u help...how to create connection string

  • @mohammednhne929
    @mohammednhne929 2 года назад

    Well done, Thank you Pat

  • @jeandedieuniyigaba321
    @jeandedieuniyigaba321 2 года назад

    Man you awesome. Can you make a tutorial about sending requests from React and have C# on the backend as well ?

  • @tdotkn9
    @tdotkn9 11 месяцев назад

    Subscribed.

  • @marouanesadiki8431
    @marouanesadiki8431 Год назад

    thanks a lot.

  • @nishantkr5759
    @nishantkr5759 Год назад

    But how did you got that database connectionString ??? there is no ef modal wizard to get that string from then how to get it !????

  • @lakshmirockzzable
    @lakshmirockzzable 2 года назад

    Great job! Thanks 😊

  • @Djw3999
    @Djw3999 2 года назад

    Great tutorial!

  • @hassan-esabbah4913
    @hassan-esabbah4913 2 года назад

    thank you bro you're the best

  • @dennismarfokojo4037
    @dennismarfokojo4037 2 года назад

    Thank you, great tuto really helpful.

  • @fahimeabouhamze6618
    @fahimeabouhamze6618 2 года назад

    thank you for your tutorial

  • @pantoffelslippers
    @pantoffelslippers 2 года назад

    Really well done!

  • @vendettamalize7209
    @vendettamalize7209 Год назад

    Is there a link for that that db?

  • @sayurirathnayake291
    @sayurirathnayake291 2 года назад

    Thank you ❤

  • @matthewbaier766
    @matthewbaier766 2 года назад

    13:25 Do we use the same connection?

  • @fgharbi6260
    @fgharbi6260 Год назад

    Super cocol video ! thx. What about if I Want an extra url like "api/Issue/EXAMPLE/id". How can I make that ?

  • @goldenpiece7087
    @goldenpiece7087 2 года назад

    Man you are a saver! This tutorial is so clean and easy to understand!sub

  • @obviousmadzime6823
    @obviousmadzime6823 2 года назад

    Thanks man..

  • @beliycat
    @beliycat 2 года назад

    Thank you! Could you explain "var issueToDelete = await _content.Issues.FindAsync(id);"? Why do you use async-method, if your main code is waiting for it to get the value for var issueToDelete ? It will still run in sync, won't it?

    • @TechWithPat
      @TechWithPat  2 года назад

      You have to think from the perstective of the caller of the delete method, the advantage of using async is that the main thread is not blocked.

  • @eagold
    @eagold 2 года назад

    18:23 "click on it", why swagger freezes when trying to open a request?

  • @skillfulactor09
    @skillfulactor09 2 года назад

    So this perfect example of building an api in c# can this be a point of reference always

  • @favorites410
    @favorites410 2 года назад

    How to add authentication to prevent requests from unknown sources?

  • @rolandotanawan1305
    @rolandotanawan1305 2 года назад

    Many thanks

  • @rajansharma7407
    @rajansharma7407 2 года назад

    unable to create migration saying Add is not correct cmdlin word why sir n

  • @saumitrasaxena8470
    @saumitrasaxena8470 Год назад

    are you on udemy ?

  • @westter3672
    @westter3672 2 года назад +10

    Everything was clear until you added a connection string without any explanation for beginners on how to get it.

    • @westter3672
      @westter3672 2 года назад +1

      Doing this is very discouraging for beginners and should not be so if it is a "for beginners" tutorial

    • @stephanieezat-panah7750
      @stephanieezat-panah7750 2 года назад +1

      I think that we need to install SQL Express. that was not explained, I think. He just blew past it

    • @located
      @located Год назад

      @@westter3672 one would expect someone learning about web apis to have some sort of experience, especially with things as basic as connection strings

  • @_MoshikoAz_
    @_MoshikoAz_ 2 года назад

    thanks for the video, any chance for a guide for mac m1 users ?

    • @Duelweb
      @Duelweb 2 года назад

      No, because Mac just sucks so badly!!! Ask Apple to provide you with their own version of Visual Studio ! :) :)

  • @baotranquoc6814
    @baotranquoc6814 2 года назад

    in 15:17, i had ran the command, but when i checked the database, i don't see the database created...

    • @baotranquoc6814
      @baotranquoc6814 2 года назад +1

      I fixed it, I change the SqlStringConnection in file appsetting.json, and my conn string is: "Server=localhost\\SQLEXPRESS;Database=master;Trusted_Connection=True;" , if anyone meet this bug then guy can use it as a template ... thanks !!!

  • @prashantmjalskar8198
    @prashantmjalskar8198 2 года назад +1

    can anyone tell me how do we get this connection string? 13:21

  • @vendettamalize7209
    @vendettamalize7209 Год назад

    Where is the copy 9f that database???

  • @MasterPigeonXD
    @MasterPigeonXD Год назад

    This makes JavaScript look like nursery

  • @bonkeselemani503
    @bonkeselemani503 2 года назад

    Thank you

  • @metekaba6532
    @metekaba6532 2 года назад +1

    Thanks for this great tutorial. I have a question that can we use WebAPI with a UI project? When I made a research on the Internet, I have seen that WebAPI is compatible for phones, tablets, and pcs. Also, I have watched many tutorials and most of them shows how to run WebAPI from the URL part. I mean, about entering the id and getting the data. But I think it is not practical for an end user to use the URL for every request, right? Is there any technology combined with web api or is it just a kind of research topic? How can we use it for a GUI Web project? Thanks in advance!

    • @TechWithPat
      @TechWithPat  2 года назад +2

      Any GUI app can use an http client and call a web api. In the future, I will try to make video showcasting Web api and other frameworks.

    • @davidemmanuel3001
      @davidemmanuel3001 2 года назад +1

      Would be great to consume it with angular

    • @metekaba6532
      @metekaba6532 2 года назад

      @@TechWithPat Thank you so much! I am waiting for your new informative video :)

  • @mohammadsorour1
    @mohammadsorour1 2 года назад

    An exception of type 'System.Text.Json.JsonException' occurred in System.Private.CoreLib.dll but was not handled in user code
    The JSON value could not be converted to System.Collections.Generic.IEnumerable`1[test_api.User].
    Can someone help please

  • @chriserc
    @chriserc 2 года назад

    Help, error update-database => A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - La cadena de certificación fue emitida por una entidad en la que no se confía.)

  • @stonedcodingtom9097
    @stonedcodingtom9097 2 года назад

    Thx!

  • @pamelagueke9811
    @pamelagueke9811 Год назад +1

    Please I have an important question, I'm blocked. HOW DO I GET MY CONNECTION STRING??

  • @nathsiblings3164
    @nathsiblings3164 2 года назад +1

    why the startup.cs file is not created

    • @drfalcoew8939
      @drfalcoew8939 2 года назад +1

      In his video, I believe Startup.cs (where the configurations are made) is combined into Program.cs

    • @Daaell
      @Daaell 2 года назад +4

      Because .NET 6 is not using one anymore.

    • @CSVUTUS
      @CSVUTUS 2 года назад

      That is new on net 6

  • @nobudy_left
    @nobudy_left Год назад

    Rider doesn't provide a NuGet Package Management Console anymore :(

  • @칩칩이
    @칩칩이 Год назад +1

    Wakanda forever