I have a little understanding on REST API. As per my knowledge it is used to work with HTTP services (GET, POST, PUT, DELETE).
When I add a Web API controller it provides me some basic methods like :
public class Default1Controller : ApiController
{
// GET api/default1
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/default1/5
public string Get(int id)
{
return "value";
}
// POST api/default1
public void Post([FromBody]string value)
{
}
// PUT api/default1/5
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/default1/5
public void Delete(int id)
{
}
}
So my question is: what's the difference between a Web API and a REST API?
By the definition of REST, the above code is REST based so what's a normal Web API in MVC? I'm a bit confused as some people say you use a Web API with REST?
Kindly provide a better understanding of them both.