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 :
Other optional components like path, port number, query strings and fragment.
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:
To sum up
We use URIs, URLs, and URNs to identify the resource