When do I use path params vs. query params in a RESTful API?

Best practice for RESTful API design is that path params are used to identify a specific resource or resources, while query parameters are used to sort/filter those resources. Here’s an example. Suppose you are implementing RESTful API endpoints for an entity called Car. You would structure your endpoints like this: GET /cars GET /cars/:id POST … Read more

What are best practices for REST nested resources?

I’ve tried both design strategies – nested and non-nested endpoints. I’ve found that: if the nested resource has a primary key and you don’t have its parent primary key, the nested structure requires you to get it, even though the system doesn’t actually require it. nested endpoints typically require redundant endpoints. In other words, you … Read more

RESTful URL design for search

For the searching, use querystrings. This is perfectly RESTful: /cars?color=blue&type=sedan&doors=4 An advantage to regular querystrings is that they are standard and widely understood and that they can be generated from form-get.

How to design RESTful search/filtering? [closed]

The best way to implement a RESTful search is to consider the search itself to be a resource. Then you can use the POST verb because you are creating a search. You do not have to literally create something in a database in order to use a POST. For example: Accept: application/json Content-Type: application/json POST … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)