Toys, Babies, and APIs: A Beginner's Guide to Understanding RESTful Services

Toys, Babies, and APIs: A Beginner's Guide to Understanding RESTful Services

Hello, welcome to my page, today I will be breaking down RESTful Services so you can understand it.

The reason I opted to write this article is that RESTful service was alien to me when I started programming. Thinking about that experience, I decided to simplify it so that even a newbie can understand it easily. I liked toys as a baby so hope you would not mind me using a toy concept throughout this course.

Is it more difficult to older people to use computers? - Quora

RESTful services are like giving your baby a toy box full of toys they can play with. Now imagine your baby wants to play with a specific toy, let us say it is a Superman (I love Superman by the way). Superman is in the toy box and the baby can request to play with it by reaching into the box and grabbing the toy. This is like how Restful services work.

Let us get a bit more technical, do not worry, I will break down complex terms for you.

How to define a RESTful Web Services?

A Restful service is a set of predefined actions (toys) that a client (baby) can request to interact with (play with). The actions are predefined and follow a specific structure (like a set of rules for the toy box). The client can request to interact with a specific action (toy) by requesting the Restful service, just like how the baby reaches into the toy box to grab a specific toy.

Before moving on, let us discuss what a client is. A client is a software application or device that requests and receives services or resources from a server over a network. Clients can be web browsers, mobile apps, desktop applications, or any other software that can communicate with servers. You understand now, right?

Now let us dig into the RESTful API. if the Restful service has an action called "getSupermanToy", the client can request the Restful service asking for the Superman, and the Restful service will respond with the Superman. This is synonymous with a baby reaching out to grab the Superman toy (Don't worry we will discuss this in detail below).

So, we are going to get a bit more technical, do not worry, I am here with you every step of the way.

RESTful services are ways applications communicate with each other over the internet, using a set of standard rules and conventions. The acronym "REST" stands for "Representational State Transfer", which means that each RESTful service is a resource that can be accessed, changed, or Deleted through a set of standard HTTP methods like GET, POST, PUT, PATCH, and DELETE. Each resource has a unique identifier, called a Uniform Resource Identifier (URI), which is used to access the resource.

Small Play By Play 1999 DC Superman Plush Toy Doll with Vinyl Head | eBay

Yes, it is a mouthful right, what does this mean briefly? It means that your baby would need help (through HTTP methods) to get the actual toy she wants. Your baby could say she doesn’t want Superman again, and that you should throw it in the wastebin (That’s synonymous with using the DELETE HTTP Method to delete a resource from the RESTful service and the cape is likened to the URI because it is what makes Superman to be identified easily).

She might say she wants to get another toy, maybe a Power Rangers this time (Then, she would have utilized the help of the GET HTTP Method to access a resource from the RESTful service)

Power Rangers: Legacy Wars - Apps on Google Play

She could want to swap the Power Rangers toy for the Superman and that was why she disposed of it (Then she would have utilized the POST HTTP Method to modify a resource from the RESTful service).

She might want the new Superman toy that her friend Tosin has because her's is outdated (Then she would have used the PUT HTTP Method to update a resource from the RESTful service).

What is REST? | Codecademy

RESTful services are designed to be stateless, which means that each request holds all the information necessary for the server to respond. This makes them very scalable and easy to cache since each request can be processed independently without relying on earlier requests or state information.

Mouthful again, right? Do not worry, I am with you.

Just imagine your baby is building houses with bricks. Each time she builds something new, she asks you to see what she has made, and like every parent, you say baby "this is so lovely".

Now, imagine you do not remember what she built the last time, and she asks again that you see what she built, you must look with fresh eyes and say baby “This looks very good”

This is like how RESTful services work. Each time a client (like your baby) requests a server, they send all the information the server needs to respond. This means the server does not need to remember any earlier requests or state information. It can process each request independently, like your baby showing you their next brick house.

This makes RESTful services very scalable and easy to cache. Caching is like remembering what your baby built and helping your baby rebuild the same brick house. It will be easier and faster to rebuild right? That is how a server can quickly respond to the same request if it has been previously cached. This makes it much faster and more efficient.

I think this should be a good starting point in learning about RESTful services.

Uses of Computers in Education - The Classroom

In conclusion, RESTful services provide a standard way for applications to communicate with each other over the internet, using a set of standard rules and conventions. It is used in modern web development and is a fundamental part of building web applications that can integrate with other systems.