Kevin.a
Kevin.a

Reputation: 4286

Types of web API's (web services)

Recently i have been doing some research about web services.

What i understand so far is that a web service is basically an API that communicates over HTTP.

There are Different kinds of web services:

SOAP web services (api that uses SOAP)

RESTful web services (api that uses The REST)

During my research those were the only ones mentioned except for one site. There they also mentioned:

XML-RPC JSON-RPC

Are those also web services? And why aren't they mentioned?

If i said something wrong feel free to correct me.

Types of Web Services There are mainly two types of web services. SOAP web services. RESTful web services.

-source: http://sfdcsrini.blogspot.com/2015/09/what-is-web-service-and-what-are.html

Upvotes: 1

Views: 2846

Answers (2)

L VEERAPANDI   BCA
L VEERAPANDI BCA

Reputation: 1

Two Type of API (Application Program Interface) was avilable.

That Was,

  • 1)SOAP - Simple Object Access Protocol.

  • 2)REST - Representational State Transfer.

Upvotes: 0

sisyphus
sisyphus

Reputation: 6392

Broadly speaking, you're correct that there are two types of web service, but it's not SOAP vs. REST. It's RPC vs. ReST. There are other types of 'web' service which don't interact over HTTP, but they tend to be for specialist use cases these days so lets ignore them for now.

An RPC service is one where the API models some kind of abstract 'object' on which some defined set of 'methods' can be called - hence the name Remote Procedure Call. Any object defined in the API can have an arbitrary set of methods defined against them and HTTP is typically just used as a transport mechanism, with all the information required for the call to happen (object identifier, method name, call parameters) being serialised into a document which is transferred to the remote end via a POST operation and all objects are accessed via the same URI. Sometimes, query parameters on the URI are used to identify the object and/or method. SOAP and XML-RPC are both types of RPC implementation styles and are similar but not the same. JSON-RPC is another RPC mechanism, it just uses JSON to encode the RPC call rather than the more verbose XML.

ReST, on the other hand, is a resource oriented API style. In a ReSTful API the application communicates with 'resources' by transferring representations (i.e. serialised document formats) back and forth. Each resource has a consistent & well defined API and a unique address, called a URI. HTTP can then be used not just as a transport mechanism but, more importantly, also as an implementation of the API. So, the only way to interact with a resource in a ReSTful API is via one of the well-known HTTP methods - GET / PUT / POST / DELETE / PATCH. Not every API endpoint will implement every method but no endpoint will implement anything other than those methods.

The most important difference between the ReSTful approach and the RPC approach is what the data transferred means. In a ReSTful API the documents transferred represent the resource which the application wishes to manipulate whereas in an RPC the document transferred represents the method call which the caller wishes to make (or its response).

Upvotes: 4

Related Questions