API PARADIGM SHIFT: SOAP TO REST
APIs lets programmers build amazing tool and Apps even with different environments.
For those who may not be familiar with API,
According to wikipedia, An application programming interface (API) is a set of subroutine definitions, protocols, and tools for building application software. In general terms, it’s a set of clearly defined methods of communication between various software components.
Server side Interface of API usually consists of standardized request-response System, typically referred as Web Services.
For developing a Api, you should follow one of design models like:
Two most dominant design models for API are SOAP and REST. SOAP used to be popular choice for making specific use Api(s). But, Now you can see paradigm shift from SOAP to REST. REST design model has gained enormous popularity, due to it’s simplicity and awesomeness.
As a developer you can follow any one as per your requirements. Let’s have a look at them:
In short, SOAP(Simple Object Access Protocol) is a protocol specification for information transfer. It provides strongly type message format for API, and relies on XML format.
POST /url HTTP/1.1
Content-type: text/xml; charset=utf-8
<!-- the results are returned here -->
REST is an architectural style, unlike SOAP which is a standardized protocol. it makes use of HTTP and uses HTTP methods explicitly. It can structure api data into JSON, XML, YAML, HTML or any other format. JSON is preferred format. Unlike SOAP, you don’t need to use verb for action but corresponding HTTP Methods like GET, PUT, DELETE, POST, PATCH.
"subject": "ticket subject",
"formatedCreatedAt": "21-Dec 10:36am",
"name": "agent name"
"name": "customer name"
More and more sites like UVdesk are following REST design pattern.
Because REST have many advantages over SOAP like
- ReST leverages HTTP, so everything is simple.
- In ReST metadata and URI are nouns, action are specified by HTTP Methods like GET, PUT, POST, DELETE, PATCH, HEAD.
- Rest API(s) are more suitable for mobile devices. so, if you may use your API for mobile Apps then ReST API is right choice for you.
- multiple data formats can be supported like JSON, YAML, XML, while SOAP provides only XML format.
- ReST services are cacheable.
- Normally, ReST is faster than SOAP. Since, it uses JSON format rather than XML.
- Rest following community is quite big. so, You can easily find suitable library for ReST implementaion.
If you have selected suitable Design Model. Then, Stay connected for upcoming API category stories . In Upcoming stories, You can have a look at our full journey of API development. Furthermore, there will all sort of tricks, tweaks and key points that we learned while developing REST API.
Note: Story can also be viewed on UVdesk Blog .