0

I'm new to the this topic MVC4 and Web api. My question could be basic but do help me. I used (http://localhost:3668/api/values) and (http://localhost:3668/api/values/3) to call the methods get and get(int id) to get executed. But don't know how to call the Post and delete method in api controller thanks.

2 Answers 2

1

Post will be detected if you click on a form button. From C# code you can do something like that

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:3668/api/values/3");
request.Method = "DELETE";
Sign up to request clarification or add additional context in comments.

Comments

0

You cannot just punch the addresses into your favorite browser. A flexible solution for development and debugging is a command line tool like curl (http://curl.haxx.se/) which is capable of sending HTTP GET, POST, PUT, DELETE etc.

In order to consume the api from your application then it all depends on your client technology. If you are making a browser based application you can use xmlhttprequest to send GET, POST, PUT, DELETE requests. If you need server to server communication you can use System.Net.WebClient.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.