All posts

Understanding URLs: Query Parameters

This and the other “Deck” posts are a repurposing of flashcard study decks to Q&A blog posts. Google was not showing love to this content as a set of flashcards and I didn’t want to delete them entirely, I hope you find it useful.

What is a query parameter?

A query parameter is a key value pair or set of pairs appended to the end of a URL.

When would you use a path parameter vs query parameter?

Query parameters are most often used to filter for resources within a collection while URL Paths are used to locate a resource type. For example is using a url path to find all cars of type Camry but is using the URL path and a query param to filter the collection of Camry’s to only give back results that include a color red.

What is a query parameter used for?

A query parameter is most often used to filter a collection of data by some attribute of that data. ex which filters a collection of cars for only those whose color is red.

What is the syntax for using a query parameter?

You first indicate you are using query parameter by using a ? followed by the key value pair, all query parameters after the first use an & to indicate there is another query param