The difference between an API and a REST API

631 views

The difference between an API and a REST API

In: 198

15 Answers

Anonymous 0 Comments

An API is an “application programming interface” between two computer programs. It’s a rule that says “if you ask me a question like this, then I will do this thing and give you an answer like this”. If computer A agrees to this contract, then it is a service that “hosts the API” or “exposes the API”.

A REST API is a “Representational State Transfer API”. People realized quickly that a lot of APIs involve changing the “state” of data by the service hosting the API. Think creating an account, check the balance, updating a password, deleting an account. It became so common that Roy Fielding published a paper describing a new “style” of APIs called REST: https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_2

Today, REST APIs typically expose four “methods” to operate on each “entity” of data:

* GET – retrieve the entity
* POST – create a new entity
* PUT – update the entity
* DELETE – remove the entity

Any service that exposes these methods and implements them so that they do those operations is considered to be hosting a REST API.

You are viewing 1 out of 15 answers, click here to view all answers.