top of page
priyasawant

What is the composition of the URL? in REST API

A REST API is accessed with an endpoint URL. The endpoint URL consists of a base URL, a resource path, and query parameters. The base URL is the internet host name for the REST API. The resource path is the address to the API resource. Query parameters are name/value pairs passed to the REST API after a ? in the endpoint URL. Query parameters pass inputs to a REST API and are often used to filter, sort, or specify the output format.


  • Base URL: Enter base URL for the web service endpoint.

  • Resource Path: Enter the path to the complete web service endpoint.

  • Query Parameters: Enter a name and value for each query parameter to pass. Query parameters are appended to the endpoint after a ? in the URL at runtime.

In above URL


Base URL:

It is a hostname or domain name. Additionally, it can be obtained from the domain registrar to name the website domain. Moreover, it often ends with .com , .net, .in, etc.


Resource Path:

It is a path. Additionally, the directory structure of a web server determines the paths.


Query Parameters:

A set of parameters attached to the end of the URL is called Query Parameters. They are appended to the URL by adding ‘?’ at the end of the URL. In addition to that, they are followed immediately with a key-value pair(Query Parameter).

In simple words, Query Parameters are a set of parameters attached to the end of the URL. Additionally, it helps to retrieve specific data and performs actions based on the inputs passed by the user. Also a ‘?’ is used immediately after the URL to append the query parameters to the URL. E.g., if you paste this URL (https://www.google.com/search?q=tiger) on the browser address bar and press enter. Consequently, google page will open with displaying Google search results for the word “tiger.”

In the case of multiple parameters, we add an ‘&’ symbol in between each of the query parameters. Note that these requests are used commonly in the GET Requests only. In other words, we use the Query Parameters when an operation involves sort, pagination, or filter operation on the items.

For instance, in the below example, I am searching for the word ‘tiger’ on Google. As I enter the word ‘tiger’ in the search box, consequently, the resulting URI gets changed to:

“https://www.google.com/search?q=tiger&oq=tiger&aqs=chrome.0.69i59j0l5.1612j0j7&sourceid=chrome&ie=UTF-8”


12,300 views

Recent Posts

See All
bottom of page