What Is URL?
URL stands for unique resource locator. URL is the location of a specific file, web page, or website on the Internet. URL is composed of several parts.
Location of URL
A URL is placed at the browser windows’ top area in the omnibox or address bar, as per the browser window. The URL is always visible on laptop and desktop computers, unless you open your browser in full screen. In most tablet and smartphone browsers, the address bar having the URL disappears after scrolling down to a lower part of the page, and only shows the domain when it is visible. Scroll up the page to view the address bar. If you can only see the domain, tap on the address bar to see the complete address.
Protocol
While going through website addresses, you might have noticed the “http:// and http:// at the start of every URL. It indicates the protocol of the URL.
A protocol informs the browser on how to establish connection with a web server for sending and retrieving information. In simpler words, it allows a URL to function properly. Usually, websites use Hypertext Transfer Protocol (HTTP) as the standard protocol.
In the past decade, there has been a massive adoption of Hypertext Transfer Protocol Secure (HTTPS). Although this protocol is similar to HTTP, it’s more secure as it encrypts data that is exchanged between the server and the browser. This is why it’s represented by a green security padlock in the address bar.
Domain Name
The second element in a URL is the domain name. It is used to identify a website, which lets you visit the home page when nothing else is added to its end.
A domain name is composed of two parts. First, there’s the website name and then comes the TLD .i.e Top-Level Domain. TLD refers to the .net, .org, .com, and other designators that are placed at the end of the domain name.
Path
If you just want to visit your website’s front page, then the protocol and domain name are enough. However, to visit the individual files or pages on your website, you need to use their own URL.
The part after the TLD is referred to as the path. It allows the browser to visit a specific page on a website. Some experts called it as a URL ‘slug’.
What Is an API?
API is short for application programming interface. You need APIs to interact with external software components. Even if you write all the code from scratch, you will need to create your own APIs for organizing your code and build a reusable code-base.
What Is Chart Image API?
The Image-Charts API is used to return an image containing a chart order to respond to a URL POST or GET request. It allows you to generate a wide range of charts, such as bar charts, line charts, and pie charts. All the chart details that you need, such as labels, colors, size and other forms of chart data, are incorporated into the URL.
In order to create a simple chart, it’s necessary to specify a wide array of details in the URL, including the chart data, size, and type. All you need to do is type the URL in your website browser. Next, use an <img> tag to refer to it in your website page. For instance, this link shows a type of chart, known as the pie chart. The link is also an instance of a standard chart API URL. The following format is used in all Chart URLs.
https://image-charts.com/chart
?cht=<chart_type>
&chd=<chart_data>
&chs=<chart_size>
&...additional_parameters...
Each URL begins with https://image-charts.com/chart?, after which other parameters follow, representing chart appearance and data. These parameters take the form of name=value pairs, which are split up via an ampersand character (&). After “?”, parameters can take any order. Each chart needs at least these parameters:
- cht – chart type
- chd – chart data
- chs – chart size
There are multiple parameters for additional options. You can also set additional parameters, depending on the supported charts.
https://image-charts.com/chart
?cht=p3
&chs=600x200
&chd=t:70,30
&chl=First|Second
&chan
&chf=ps0-0,lg,45,ffeb3b,0.2,f44336,1|ps0-1,lg,45,8bc34a,0.2,009688,1
- The base URL for all chart requests is https://image-charts.com/chart?
- cht = p3 The chart type: here, a 3D pie chart.
- chs = 600x200 – specifying the chart size in terms of width and height in pixels
- chd = t; 70, 30 – specifying the chart data. Although, we have used a simple text format, you can opt for other formats.
- chl = First|Second – Setting the labels for the slices.
- chan = Animate the chart to render a gif
- chf = ps – Setting a linear gradient for each pie slice
- & -- Ampersand is used to separate parameters.
When URL is embedded in HTML, for instance as the tag’s src attribute, you should substitute the “&” between parameters with the characters “&”. This includes generating page PHP and HTML, or some other language.
For more details, you can visit this link.