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.
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!
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.
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!
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.
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
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?
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.
@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!
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.
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
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.
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
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.
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
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 :)
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
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
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
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.
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
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?
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!
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?
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'." }
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!
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
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)!
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
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
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
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
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
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.
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
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.
Hey B Toz,
Thanks for watching!
Jon
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.
Hi Kranti,
Thanks for watching!
Jon
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!
Hi Adrian,
You are welcome! Thanks for watching!
Jon
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
Hi Frank, thanks for the kind words!
This is the most elegant video on the shortest time ! Great work !
Hi Sakthi,
I'm glad it was useful!
Thanks
Jon
Starting my journey with Visual Studio. This helped! Thank you! Will following other postings.. Well done..
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!
Hi Rajob,
Thanks for watching! Let me know if there is anything specific you are interested in.
Thanks
Jon
Great Job... Thank you Jon for your effort...
My pleasure!
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.
You are Welcome Gary, please let me know if there are any other areas a video would be useful. Thanks!
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. :)
Hi Gary, I will add that to the list.
Thanks again - Jon
A very solid teaching performance. Easy to follow.
Hi Wayne,
Thanks for watching!
Jon
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!
Hi Lindsay,
Thanks for watching!
Jon
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.
Hi Bryn,
Great, I'm glad it was useful. As soon as VS2019 release expect a new set of videos.
Thanks for watching.
Jon
Clear, concise, and it works. Thanks!
thanks jon, if only all videos were that easy
Hi Osamah,
Thanks for watching!
Jon
Thank you for this tutorial. Very clear and simple.
Hi,
You are welcome. Thanks for your comments and for watching!
Jon
Great tutorial and easy to understand.
Hi,
Thanks for watching!
Jon
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 ?
Thanks Jon, this was really helpful. :)
Hi Dean,
Thanks for watching!
Jon
Thanks Jon Jensen!
It will work fine to what I want.
Thanks for watching!
Excelentes videos, Saludos desde México.
Hi Victor,
Gracias! Thanks for watching!
Jon
Very good! Thank you
DHC chrome extension is not available....
what is the alternative??
Hi Tony,
In later videos I switched to Postman. I really like it and use it all the time: www.postman.com/
Jon
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
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
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
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?
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.
Thank you, thank you, thank you...
Hi ,
You are welcome. Thanks for watching!
Jon
@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!
Hi Han,
You will need to choose if you want to do Web API or MVC. They are similar but not the same.
Jon
Thank you.
Hi Yusuf,
You are welcome!
Jon
nice intro.
Hi Jon. Can you please share the source code? Thank you.
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.
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
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.
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
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.
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
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 :)
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
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
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
Hi Evgeny - awesome! Thanks
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.
Hi Madarino,
Make sure you are not using https. Thanks for watching!
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
same here...
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.
Ignore the error. Just append the method call, ie. localhost:19885/api/Person (use the Restlet client for a nicer view)
Wicked, cheers dude
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
Thanks!
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?
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!
Hi Rubens,
Great, I'm glad you were able to solve that.
Thanks for watching!
Jon
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.
Hi Kumaresh,
It sounds like you are having an issue with the database connection. I would check your database connection.
Thanks for watching!
Jon
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?
Hi Angela,
You are welcome. What do you mean by a WebHook?
Thanks
Jon
Will this REST services can be used in an iOS phone application using xCode & Swift?
Yes! I will see if I can work up an example for you in the next few days.
Thank you. Can't wait. Good video by the way.
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.
Awesome, thanks for doing this. I really appreciate your help.
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
HI Jon, Is the Code available...?
Hi David,
I'm working on getting on Github.
Jon
When i create a new api project, i can't add folders "web API". Do you know the reason? Thanks!!
Hi Xavier,
What specific steps are you trying to do?
Jon
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
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
Alright, thx for all
Hi Xavier,
The video is up on configuring Visual Studio 2017. Let me know if you still have a problem after configuring.
Jon
You did this in Visual Studio 2015. Can you do the same in 2012?
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'."
}
Hi,
Do you have a controller that looks like this:
public class UserController : ApiController
Please let me know.
Thanks for watching...
Jon
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!
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
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)!
Getting a 403.14 error after running?
Hi Cooper,
Were you able to resolve this?
Thanks for watching.
Jon
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
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
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
Hi Michael,
You can send it to jjdevry@gmail.com. I'll take a look.
Jon
Hi all,
Resolution on this was to make sure the controller class name ends with Controller - like MySuperController.
Jon
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!
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.
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
Why the need to download the source code here? Isn´t all the code written by Visual?
(apart from the slight modifications (value -> person))
appreciate
Could you do a new video where you show us how to add a second controller? Expanding the API server :)
Hi Dj,
Sure, I'd be happy to. Thanks for watching!
Jon
Que tal Jon. Te envió un cordial saludo y aprovecho para preguntarte si vas hacer algún curso sobre WCF. Gracias!!
Hola Victor,
Todavia, no. Estoy pensando en hacer uno in el futuro.
Muchas gracias por ver el video.
Jon
¿¡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!
a mi me sale xml Soap y no REST???
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
Hi Jon, excellent tutorial! Can we download the source code from somewhere?
Hi,
Yes, I'm working on a way to have it accessible.
Thanks for watching!
Jon
Thank you!
Can you please provide a LINK to the source code once it is available? Thanks.
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
Hello Jon, very nice tutorial! Can I download the source code from somewhere?
Hi,
Thanks for watching, I'm working on a place for the source code.
Jon
Hello Jon, is it possible to post the projets on github ? (otherwise do you give me the permission to do it?)
Hi Philippe, Yes it will be up shortly.
Thanks for watching!
Jon
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.
Hi, please check out: ua-cam.com/video/UksI-hKCNYs/v-deo.html
That should help.
Jon
Hello, can this be done with VS 2012?
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
Jon Jensen Hi, I've managed to go on with the tutorial on VS2012, so far so good, thank you for the reply :)