Wednesday, 12 February 2020

Query params best practices?

What is kind of suggested best practice for URL queries? Do you prefer going for the key = string route? Or the key = id route?A) URL.com/books?author=JKRowling&category=novelB) URL.com/books?authorID=242&categoryID=4I'm currently building a little filter using the option A way, but sometimes I'm wondering if that's the right move or not because it requires me to search my SQL table for string, then return the id to get more data. Such as:search author table for string, return author.idsearch category table for string, return category.idsearch books table for author.id and category.idORsearch books table for authorID and categoryID (from the query)Typing this out makes me realize that option B seems like the better/faster option, but I'd like to get people's opinions. Does seeing a string in the browser over a bunch of numbers matter to you?

Submitted February 12, 2020 at 07:47PM by keithj0nes

No comments:

Post a Comment