mardi 2 avril 2019

REST API vs Web API

I am a beginner in building HTTP APIs and I seem to be confused about the difference between REST API and Web API. More I read about it on the web, confusion seems to add up. I guess Fielding has the same issue as per this link http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven

I built an HTTP API at work thinking I built a REST API as everywhere I read, they were building Web/HTTP API and calling it REST.

When I found one API adhere to HATEOAS principle was the one Github REST API https://api.github.com. I tried using it for my username at Github (GET https://api.github.com/users/vvs14), it returned all related links as per HATEOAS principle.

It is one of the best real-world API which is close to REST specification, IMHO. Although I could not understand which URI supports what operation on it and how to find it in case of any REST API if I am a consumer of it or how to tell it to the consumer if I am hosting the API?

One good blog on it is https://www.e4developer.com/2018/02/16/hateoas-simple-explanation/.

All other examples are given in most of the blogs just tell to use JSON to be REST API, put everything as Resource to be REST API and use HTTP verbs for CRUD operations to be REST API. I don't find any to these to be true.

At my work, I use Sendgrid's Web API to send emails to clients and they call it Web API, not REST, which I think is pretty true.

Can anyone please clear the difference between these two, with examples?

If Github API is a right example of REST API, how can we know which URI supports which operations as Media type is not mentioned here?




Aucun commentaire:

Enregistrer un commentaire