1

I am very confused by the terms API and REST API. What is the difference between them. I am a Django developer and have to work on both but I don't know the difference between them . And another question: Is SOAP API and API the same thing?

Jacques de Hooge
  • 6,204
  • 2
  • 19
  • 37
Cp Verma
  • 452
  • 5
  • 15

2 Answers2

0

Broadly speaking an SOAP and REST are special types of APIs. To learn the difference, have a look at this other post.

SOAP vs REST (differences)

Community
  • 1
  • 1
Joshua Howard
  • 694
  • 1
  • 8
  • 23
0

"Standard" API

An API is a "normal" application programming interface, such as a class library, or a file containing methods which can be used to make development easier.

Examples: - the .Net Framework - The Java framework


RESTful API

A REST API (aka RESTful API) is also an application programming interface, however the main difference between the two is a REST API is called via the HTTP(s) protocol, and uses different URLs (routes) and the different HTTP methods to perform different actions, get, send, and/or delete data from a backend application.

I'll give you a couple of examples below:

HTTP GET

The GET method (the same method your browser uses to open and display a webpage) is used to fetch data from a server or backend application, such as a webpage. (E.g.: http://stackoverflow.com)

As you can see in the URL, the data is passed visible to the end-user via the URL.

Using GET is not considered safe for transferring user data!

HTTP POST

The POST method is used by web forms to send data to a server without it being visible. E.g.: You're sending a user's login details to a server for confirmation. You don't want this information to be (easily) visible, so you can send it via POST.

HTTP PUT

The PUT method is used for sending data to a server for storage. Say, for example, a new user has registered an account on your website, you might use PUT to send the data to a script which manages the database.

HTTP DELETE

This method is not enabled everywhere by default! The DELETE method, as the name would suggest, is used for deleting data from a server. E.g.: A user has sent a request to your server to delete their account. This might happen using the DELETE method.


NOTE: These are pretty vague descriptions. These do not dictate what you have to use each method for. Also, I only covered the basics. There are a lot more HTTP methods out there.

For more information on the methods available, check out this link: https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

I hope this gave you an idea of the differences between the two.

SimonC
  • 1,149
  • 1
  • 15
  • 33