As a no-code developer, understanding URLs is a fundamental aspect of your skillset. URLs serve as the language of APIs and are used to send requests to access specific resources and perform actions on them.
In addition to APIs, URLs play a crucial role in web scraping and data extraction. They identify and locate the web pages and resources you need to extract information from.
Moreover, being familiar with URLs is important for troubleshooting and debugging. By being able to see the exact requests being made, you can quickly identify any issues and resolve them efficiently.
Understanding how URLs are constructed is key in effectively extracting data from the right sources. The most important parts in a URL are highlighted below:
The Protocol
The Protocol is the first part of the URL, and this tells your browser what protocol to use when requesting the resource (a protocol is a set method for exchanging or transferring data around a computer network). The scheme indicates whether you'll be using HTTP or HTTPS (Encrypted) when you're requesting this content from the server. When using HTTP the data sent between the client and server will be encrypted, only the IP address and port will be visible.
A protocol is a set method for exchanging or transferring data around a computer network
The Domain
Next follows the Domain, which is separated from the scheme by the character pattern "://" . It consists of two or more names separated by a “.” Domain names are read from right to left. The right most part is the Top level domain or (TLD). There are a limited set of TLDs like “.com”, “.net” or “.dev” as of writing there are 1589 TLDs, including most country codes.
The domain specifies what server should handle the request. toddle.site and weather.toddle.site will be sent to different servers on the internet.
The Port
The port specifies what application on the server we want to connect to. Web servers might run multiple applications on the same server. Each application is set to listen for traffic on a predefined port. The port is usually omitted if the web server uses the standard ports. (443 for HTTPS /80 for HTTP)
The Path
The path to a file in a URL is the location of the file relative to the domain name. It specifies the location of the resource being requested and is represented by the characters that follow the domain name. Traditionally the path would match a file path on the servers hard drive, but in modern web servers this is more of a metaphor. The path specifies what operation within an application should be performed. This includes what page of a website should be downloaded, or what data should be fetched from a REST Api.
The Query or Query Parameters
As a no-code developer, understanding query or query parameters is crucial when working with web-based services and APIs. Query parameters are used to specify additional information or options when making a request to a server. They are added to the end of a URL, following a "?" character. For example, when making a search request to a website, the search term may be passed as a query parameter, like this "https://example.com/search?q=searchterm" . The query parameter "q" specifies the search term and the value "searchterm" is the actual search term entered by the user. Understanding how to use and construct query parameters allows you to communicate effectively with web services and APIs, and to retrieve the data you need.
The Anchor
An anchor in a URL, also known as a fragment identifier, is a specific part of a web page that is identified by a unique string after a "#" symbol in the URL. It allows linking to a specific section or element within a web page, rather than linking to the entire page. Anchors are commonly used for navigation within long pages, table of contents, or to highlight specific content on the page. They are useful for creating more user-friendly and efficient navigation for visitors to your website.
How does this look when using toddle?
Let’s have a look at the following toddle URL:
https://todo.toddle.site/login?redirect_url=/
”https://” : On toddle we serve everything over https to protect our users privacy.
”todo.toddle.sit” : toddle apps are run on a subdomain of the toddle.site.
”/login” : Each page of a toddle app specifies what path it should be on
“redirect_url=/” All toddle pages can accept additional query parameters too.
So there you have it! A look at how Url's work and what is going on behind the scenes when we use them.