REST, RESTful web service, API, SOAP…what’s the difference?

“person on skyscraper taking a photo of building below during nighttime” by Yiran Ding on Unsplash

HTTP

  • HTTP method — verbs like GET , POST , PUT , DELETE . They define the action which we would like to perform on a resource. For example, when we would like to fetch the HTML docs of this post we use GET method. But if we would like to add new one to the server, we would need to use POST . Of course, depending on a web server, such action could be allowed or not.
  • Resource path in order to perform any action on a resource we need to first indicate it’s path (address). Without that server would not know what resource we would like to fetch, update or delete.
  • HTTP protocol version — during years HTTP evolves, today most of web servers are still supporting HTTP/1.1.
  • Header (optional) — consists some additional information for a server, like in what langauage response will be accepted, what type of data should be sent back, cookie and authorization information, and other. The whole list could of fields that can be added are here.
  • Body (optional) —is usually used when we would like to send something, POST , to a server.
  • HTTP protocol version
  • Status code — these are the codes that indicates the success of the request. Apart from the popular 200 (OK status) or 404 (resource not found). There are others like 201 (resources created) or 500 (developers hate this one in particular 😉, it means that a server throw an exception). Their list can be found here.
  • Status message— the description of each code, e.g. 404 is Not Found.
  • Headers — similar to the request, but here it is required.
  • Body (optional) — contains the resource that we would like to fetch, e.g. HTML doc, JSON or XML file, image, video, etc.

Web service

API

SOAP

REST

  • Expose resources via URL, like /users/3 ,
  • Make use of HTTP methods, like GET , DELETE and so on,
  • Provides information about the response in a response code,
  • Each respond should also provides hyperlinks to other resources, so the client will be able to navigate the API. In simple words, if parent resource has a child it is a good thing to add URL to a child resource.

References

--

--

--

Java Software Developer, DevOps newbie, constant learner, podcast enthusiast.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Ansible as Infrastructure as Code tool for deployment of Azure resources

Apple Developer Certificates, Identifier & Profile Management

MongoDB Enterprise Operator: Deploying MongoDB in AKS

Coding — a Beginners Guide

How To Deal With Spaces in Paths on Mac and Linux

Software is Virtual; the Virtual is Disruptive; Software Disrupts the Development of Software

Managing the state of a Widget using bloc | Flutter

How to seriously upgrade your Mac terminal (and even give it a Matrix theme)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Wojciech Krzywiec

Wojciech Krzywiec

Java Software Developer, DevOps newbie, constant learner, podcast enthusiast.

More from Medium

What is REST?

Start with Spring Boot

Microservices [Part 3] — With Maven, Spring Boot, And Docker

Spring Boot Test