Table of contents
1.
🙋Introduction
2.
📢RESTful Addressing
3.
URI(Uniform Resource Identifier)
3.1.
Implementation
4.
Frequently Asked Questions❓
4.1.
What does REST stand for?
4.2.
What are RESTful web services?
4.3.
Name some HTTP Verbs.
4.4.
Can we use uppercase while designing a URI?
5.
Conclusion🔚
Last Updated: Mar 27, 2024
Easy

RESTful - Addressing

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

🙋Introduction

Do you know what REST stands for? REST is an acronym for REpresentational State Transfer. It is a web architecture, which means the procedure we follow to create and design web services. It uses HTTP protocol. We create web services that use REST architecture. A RESTful web service has URI and HTTP methods.

introduction

REST is a stateless client-server architecture. When we talk about the RESTful web services architecture we consider every web service as a resource having a URI. The Client App that use REST, use HTTP methods to communicate with the web services. In this article we will see how do we locate a web service using an URI(RESTful Addressing) and how to design a proper URI. Before proceeding, read more about RESTful Applications and RESTful Resources. Now let us see about RESTful Addressing.

📢RESTful Addressing

What do we understand by an address? Something that helps us locate something, right? The same happens here. The address allows us to find a resource or resources on servers.

restful addressing

As we saw in the introduction, a RESTful web service has a URI(uniform resource identifier). This URI helps in locating a resource in REST architecture. 

Let us see what a URI looks like👇-

<protocol>://<service-name>/<ResourceType>/<ResourceID> 

 

This URI will help us locate the resource with the specified resource type and id on the particular server.

We will see what are the best practices for designing an URI but first let us understand URI a little better.

URI(Uniform Resource Identifier)

URI helps us in locating a resource on the internet. There are some basic features which a URI has. Let us see those features:

  1. Uniqueness: URI helps us to identify a resource on the internet. Each resource on the internet has a unique identifier. 
     
  2. Extensibility: URI is assigned to every resource which is not even part of the network.
     
  3. Universality: URIs should be able to locate every resource available on the internet.
     
  4. Fixability: Once a URI is designed we should be able to change it. 
     

Implementation

Let us now see how we can make a Standard URI:
 

There are some essential points that we should consider while making a URI. These are not fixed rules but some points we must remember to make a good URI. Let us see those important points👇.

 

1. While making a URI, we should always use plural nouns. For example, use customers if using in a URI instead of customer.
 

2. Use underscore or hyphens instead of giving spaces. For example: replace verified customers with verified_customers. 

 

3. Do not use uppercase while making a URI. 


4. After updating the URI, we should ensure that the older URI must be directed to the new one. HTTP status code 300 helps us redirect the older URI to the newer one.

 

5. We should never use the operation name in the URI. We have HTTP Verbs that help us in performing operations on the resources.

 

Let us see an example👇 of a URI without considering the conventions:

 

http://localhost:8080/CodingNinjas/rest/Coding Ninjas Studio/getIntern/1
 

 

Now let us see the better way to represent the same URI👇:

 

http://localhost:8080/CodingNinjas/rest/Coding Ninjas Studio/interns/1

Frequently Asked Questions❓

What does REST stand for?

REST is an acronym for REpresentational State Transfer.

What are RESTful web services?

The web services that use REST architecture are known as RESTful web services.

Name some HTTP Verbs.

Some HTTP Verbs are GET, PUT, DELETE, and POST.

Can we use uppercase while designing a URI?

Yes, we can use uppercase while designing a URI. However, it is not recommended to do so.

Conclusion🔚

This article was an insight into RESTful addressing. We learned what REST means. We also saw the different points we must be mindful of while designing a URI. Also, check out other articles like RESTful - Methods, RESTful - StatelessnessRESTful - Application, and RESTful - Resources.

Why not have a look at web technologies on Coding Ninjas Studio? Don't stop yourself here. Also, practice data structures and algorithmsinterview questionsDBMScomputer networks, and operating systems to crack the interviews of big tech giants. Explore other fields like machine learningdeep learningcomputer vision, and big data. Also, check out Interview Experiences for different companies.

Happy learning!

Live masterclass