r/learnjava • • Feb 08 '23

API, REST & RESTfull

what is the difference between API, REST and RESTful?

I was researching articles, blog and what I understood was: API is a ready-made application that can be implemented in your project. REST, an architecture that contains functions: PUT, DELETE, POST, GET, etc. RESTfull, and the application of REST.

But I'm still trying to understand what exactly an API would be? any coding that contains controller, service and model and an API?

Can I create a workshop API and then implement a front end layer on top?

44 Upvotes

17 comments sorted by

View all comments

8

u/teefj Feb 08 '23 edited Feb 08 '23

REST != HTTP

The HTTP verbs POST, GET, PUT, PATCH, and DELETE are not defined in REST. Honestly it can be very confusing at first to see what the actual foundations of REST are.

You could read the original paper by Roy Fielding defining REST. It was published 23 years ago. Or you could skim some medium articles and hope the author understands what they are preaching. Different entities might describe how to write a RESTful API that Fielding would disagree with. So try to pick up the core concepts and move on. I think it's easy to start with the idea that the client should be separated from the server, i.e. the user interface is one application that talks to a different application which handles data (server). Then continue on down the rabbit hole.

The vast majority of newer APIs are web based, so using HTTP makes sense. But if you're making a windows application, you may need to target the Windows API, which is not inherently RESTful AFAIK.