Clear understanding about URIs, URLs, and URNs can be quite useful in the long run.
URI = Uniform Resource Identifier ( It is a string of characters used to identify a resource on the internet either by location or by name or both. )
URL = Uniform Resource Locator ( It is a string of characters but it refers to just the address(location of the resource) . It is the most used way to locate resources on the web. )
URN = Uniform Resource Name ( It is the name of the resource.)
So technically URI is either URL or URN. Therefor every URL or every URN is a URI.
To avoid the confusion lets see examples and uses:
A URL( what we use in the web browser actually to get a web page or image ) consists of two required components :
->The protocol
->The domain.
Other optional components like path, port number, query strings and fragment.
Ex: https://www.example.com/products/product.php?id=1#details
Here https is the protocol, www.example.com is the domain name, products/product.php is the path, id=1 is the query string and #details is the fragment
Whenever we deal with rest web services, we comes with the term URI. Whenever any rest base web service is running in server, to identify this web service whatever we use is called URI
Example of REST Web Service:
Without parameter
https://wpartisan.net/wp-json/wp/v2/posts
With parameter
https://wpartisan.net/wp-json/wp/v2/posts/?categories=11
To sum up
We use URIs, URLs, and URNs to identify the resource