Sobes.tech
Junior

What parts does a URI consist of?

sobes.tech AI

Answer from AI

A URI consists of the following parts:

  • Scheme: Indicates the access protocol to the resource. For example, http, https, ftp.
  • Authority: Consists of optional credentials, host, and optional port.
    • Userinfo (optional): Username and password, separated by a colon, followed by @. Example: user:password@.
    • Host: Domain name or IP address.
    • Port (optional): Port number, preceded by a colon. Example: :8080.
  • Path: A sequence of segments separated by slashes, defining the location of the resource on the server. Example: /path/to/resource.
  • Query (optional): Query parameters, starting with ? and separated by &. Example: ?key1=value1&key2=value2.
  • Fragment (optional): Identifier of a part of the resource, starting with #. Example: #section.