Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Any good resources for learning web API's?

  • 17-02-2014 4:30pm
    #1
    Registered Users, Registered Users 2 Posts: 649 ✭✭✭


    Hi,

    I've recently been trying to get into learning web api's. I want to create a basic little program which has a C# windows form to get feedback (text boxes only) and then talk to the api which then talks to a microsoft SQL database and stores the data from the feedback program through the api...I'm not too clear on it yet.

    I'm familiar to a certain point, being a student, with C# using the .NET framework however I find it next to impossible to find good tutorials, or even to follow tutorials, for api's.

    They seem to take the approach that you should already know something about it, whereas I need some sort of "hand held" approach where I get lead through step by step on how to do things, and more importantly, why I'm doing it...otherwise I'll never learn.
    Yet the videos and written tutorials seem to go "Ok here's how I did it [Code shows up on screen] go ahead and copy [from the video] the code / copy paste [from written tutorial]" which I find confuses me more than anything.

    A good book or some good web tutorials is what I'm after really, not sure if that's possible hence asking the question.

    An example of what I'm after can be found here, I used those tutorials to learn C# and windows forms which I found invaluable.

    Thanks in advance, and I apologise if this comes across as a silly question...I literally have no idea what I'm doing despite trying to learn from tutorials and the like so far.


Comments

  • Registered Users, Registered Users 2 Posts: 21 lunar.wire


    I'm not exactly sure what you mean by "Web API" (could be my lack of knowledge)
    The example you gave where you store info from a c# program to a database does not require the web, so I guess you are thinking more in terms of server side scripting. (ASP.NET or php).

    In that case you'd need to think of the server/client relationship, which goes something like this:
    -> your c# program would run on the client and get the info
    -> then it would send info to the server via XMLHttpRequest(or whatever).
    --> The sever would receive the response and use the info (e.g. storing it in a database) ... that's where the php or ASP would be.
    --> Then the server would send back a "success" or "fail" message
    -> your program would handle the info received from the server..... as in display a message

    To do the above you'd need to set up a server on your local machine. I don't know how to do that for Microsoft technologies, but if you wanted to use php and mysql you could use a WAMP server.


  • Registered Users, Registered Users 2 Posts: 3,078 ✭✭✭onemorechance




  • Registered Users, Registered Users 2 Posts: 649 ✭✭✭Steviemoyne


    lunar.wire wrote: »
    I'm not exactly sure what you mean by "Web API" (could be my lack of knowledge)

    To do the above you'd need to set up a server on your local machine. I don't know how to do that for Microsoft technologies, but if you wanted to use php and mysql you could use a WAMP server.

    Hi, yes I was referring to ASP.NET, I have the server set up locally and the C# program which basically takes in an integer ID and a few string text fields using text boxes. The server mirrors those fields along with it's own int ID.

    It's mainly the ASP.NET web API I'm struggling with, specifically with MVC 4 using Visual Studio 2012 I probably should have explained it better. So I'm mainly looking for resources to help me learn asp.net web api using C# and Microsoft SQL as the database.


  • Registered Users, Registered Users 2 Posts: 649 ✭✭✭Steviemoyne



    I've looked at those tutorials in the past and while they look good none of them are C#, I might try and complete it using Javascript or python as I have a little experience using them. I mainly wanted to do it using C# but if I can get my head around the javascript approach or the python approach I should be able to translate what I need to do in C#.


  • Registered Users, Registered Users 2 Posts: 265 ✭✭scorn


    You could also try Pluralsight - I think you get it free for a while (may be enough time for you to decide if it will work for you) and there are a good number of permanently free tutorials - one of which is MVC4 (if I remember correctly).

    It may not be exactly what you are looking for but give it a try and see.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 649 ✭✭✭Steviemoyne


    scorn wrote: »
    You could also try Pluralsight

    I'll give this a shot, it can't hurt to see.


  • Registered Users, Registered Users 2 Posts: 1,266 ✭✭✭Overflow


    So you want to create a web form and post some data to a server to save in a database ?

    Could not get an easier tutorial than this, this seems to check all your requirements. Its very easy to follow.

    http://www.asp.net/mvc/tutorials/mvc-5/introduction/getting-started


  • Registered Users, Registered Users 2 Posts: 649 ✭✭✭Steviemoyne


    Cheers for the helpful links. In the end I used a plugin for Visual Studio 2012 which added in tools for ASP 2 (which VS 2012 does not have, but VS 2013 does have) and I also added in the Entity Framework into Visual Studio 2012. I then created an "ASP.NET Web API 2 Empty Project" right clicked the Model folder and added a new item, added in an ADO entity set by choosing my database and connection details.

    After that it was just a simple case of adding in a controller "Web API 2 Controller with actions, using Entity Framework" one of the preset templates from adding in Entity Framework into VS 2012. Choose my Model class (the one from the previous step) and my entity set which gets created when you choose your model class.

    After running then it does exactly what I needed, just had to go back to my windows form application and connect using a Http client inside the code. Excuse me if I'm not making much sense, it works that's all I'm concerned with. Next step is setting up a form to show the data as well as post the data. It's all starting to come together at least, thanks for the links they helped.


  • Registered Users, Registered Users 2 Posts: 1,266 ✭✭✭Overflow


    Can i ask why your Windows Form application needs a Web API ? Cant you just access the database, whether remote or local, directly from the windows form application? You don't need the extra Web API layer.


  • Registered Users, Registered Users 2 Posts: 649 ✭✭✭Steviemoyne


    I'm not really sure to be honest. I just wanted to see if I could get connected that way and view with one form and update with another. I'll put my hands up and say I don't fully understand what I'm doing. But it was a nice little test, I got to look at ASP.NET, setting up a microsoft SQL database and got a look at connecting to an API from a windows form. I'm pleased from the view of an educational test for myself anyway.


  • Advertisement
Advertisement