The difference between an API and a REST API

611 views

The difference between an API and a REST API

In: 198

15 Answers

Anonymous 0 Comments

An API is just the interface into a library or something.

Consider cars. The API would be the steering wheel, the gas pedal, the turn signals, the shifter and the brakes for instance. It is standardized so you can go into any car and operate the car in the same way because it has a standard API.

Now REST API is just an API. In our car example, just imagine that REST API is the stick shift API. WHere this is a clutch and gear shift.

Then you might get into a forklift. Well the API is different, do you know the forklift API? It’s in the Forklift manual, you can read it and use the forklift once you understand its API.

In programming, the API is the set of functions you can call from your program to get a library or OS to do something.

Anonymous 0 Comments

REST APIs follow certain conventions which makes their behaviour predictable. Want to add a new comment to a post? The route and method will be “POST posts/:postId/comments”, for example.

A “regular” API doesn’t necessarily follow any established conventions

Anonymous 0 Comments

You mean SDK and API. Because as far as I know APIs are REST-based. Maybe some follow a different protocol than REST.

Anonymous 0 Comments

REST is just a specific type of API. SOAP is probably the second most common. They’re both APIs.

Anonymous 0 Comments

REST API should revolve around resources/objects, so the endpoint should look something like:

/companies/321/departments/567

Then you have the method which determines what you’re doing to the resource, like:

GET (to read), POST (to create), PUT (to update), and DELETE (to delete).