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

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024

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

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

    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 Год назад

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

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

      @@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!

  • @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

  • @SiaD777
    @SiaD777 Год назад +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 Год назад +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 11 месяцев назад +1

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

  • @ibrahimhammed4176
    @ibrahimhammed4176 7 месяцев назад

    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 8 месяцев назад

    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!

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

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

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

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

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

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

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

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

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

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

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

      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 3 месяца назад

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

  • @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 3 месяца назад

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

  • @oluja1314
    @oluja1314 Год назад +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.

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

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

  • @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 Год назад +1

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

    • @located
      @located 7 месяцев назад

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Your Teaching is Clear. You just earned a new subscriber

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

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

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

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

  • @dungle-wh9td
    @dungle-wh9td Год назад

    Charming TechWithPat always love his tutorials. Appreciate!

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

    Good Video, Thanks !!

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

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

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

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

  • @Tech-SavvyPro
    @Tech-SavvyPro 10 месяцев назад

    Good one

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

    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! 👍

  • @DanielFrankDK
    @DanielFrankDK Год назад +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?

  • @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.

  • @almikurniawan5082
    @almikurniawan5082 Год назад +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?

  • @NavinKumar-pm2ec
    @NavinKumar-pm2ec Год назад

    Nice explaining Pat. Thanks . Appreciate it.

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

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

  • @user-cb3zs6qx1m
    @user-cb3zs6qx1m Год назад

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

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

    how do you get the connection string?

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

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

    • @stephanieezat-panah7750
      @stephanieezat-panah7750 Год назад

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

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

    Very nice tutorial. Informative. Very clearly explained

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

    very clear explanations, thank you

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

    Thank's for this amazing tutorial

  • @user-tz9ov9lh8z
    @user-tz9ov9lh8z Год назад +1

    Wakanda forever

  • @MasterPigeonXD
    @MasterPigeonXD 7 месяцев назад

    This makes JavaScript look like nursery

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

    Nice to see more videos like that

  • @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.

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

    Thanks for this great tutorial

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

    this is a great tutorial. Thank u

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

    Thanks for the tutorial..

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

    Well done, Thank you Pat

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

    Wonderful! Thank you Pat!

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

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

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

    Thank you, learnt new things.

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

    Perfect tutorial. Thanks a lot :-)

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

    Really well done!

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

    Great job! Thanks 😊

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

    good tuto for beginning

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

    Great tutorial!

  • @user-cn1yw4jw8h
    @user-cn1yw4jw8h 10 месяцев назад

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

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

    Thank you, great tuto really helpful.

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

    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.

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

    Good stuff 🎉

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

    thank you bro you're the best

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

    Subscribed.

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

    awesome 🙂 thank you

  • @SomeBody-bk5op
    @SomeBody-bk5op Год назад

    Awesome!

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

    thank you for your tutorial

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

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

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

    You are amazing !!!

  • @STUPIDYOUTUBE_HIDINGMSGS
    @STUPIDYOUTUBE_HIDINGMSGS 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

  • @Noel_VI
    @Noel_VI Год назад +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  Год назад +1

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

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

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

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

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

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

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

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

    Thank you ❤

  • @nishantkr5759
    @nishantkr5759 6 месяцев назад

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

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

    Many thanks

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

    Thanks man..

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

    thanks a lot.

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

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

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

    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?

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

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

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

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

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

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

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

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

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

    Thank you

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

    13:25 Do we use the same connection?

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

    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  Год назад

      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.

  • @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?

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

    Thx!

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

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

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

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

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

    How to add authentication to prevent requests from unknown sources?

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

    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

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

    Is there a link for that that db?

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

    Where is the copy 9f that database???

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

    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.)

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

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

    • @baotranquoc6814
      @baotranquoc6814 Год назад +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 !!!

  • @_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 ! :) :)

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

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

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

    are you on udemy ?

  • @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 :)

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

    You showed us how to GET something in a client, but you never showed us how to POST DELETE or PUT something, how?