Query Strings in GET methods: Summarised

Query Strings in GET methods: Summarised

So I wrote up this long blog post yesterday but it was an exploratory blog post - I wanted to sum things up.

That way, I will feel like I have learned it properly. 

So, here we go.

Definitions: What is a query string in a GET method?

A query string is that part of the URL that comes after a question mark. 

Kind of like in objects (or dictionaries), it consists of a key-value pair (or key-value pairs!!!) that assign values to SPECIFIED parameters. 

So if I want to search by specific parameters - I might want to search for certain objects of a specific colour. So for example:

?color=blue

?color=red

?color=purple

and you could have

?color=purple&size=large

?color=red&size=small

So here you have multiple key-value pairs - and they are separated by an AMPERSAND ('&').

  • Each key-value pair is separated by an equals sign (=)
  • Multiple key-value pairs are separated by an ampersand (&) 
Query strings are used to pass data to web servers.

They can be generated through searches, from submissions, or by typing queries directly into the browser's search bar. This also means that I can create a url (unawares) as a user and send it to my friend and it will take them to the exactly the same place.

In summary: they can be useful for tracking and personalisation in digital marketing (I don't really know how this is, though). They allow the content of web pages to be dynamic which is awesome - dynamic is exactly what we want web content to be. Gone are the days of the static websites of the early 2000s (or whatever - sorry I was very very young haha!).

They can even be used in web analytics - and help to track and analyse user behaviour. Again I don't really know how. But I do know that they can be used to "pass query data to web servers."

Pictures of coding and ones and zeroes interspersed with post it notes and text bubbles. Text reads: query strings in het methods. Follow the "?" question mark. Come in key value pairs (=). You can group multiple pairs by an ampersand.

Edit: the original photo had typos (it's 7 pm and I've been coding all day) but I have updated it now and edited it now - thank you!!!.

Comments

Popular Posts