0

I have two REST endpoints with the following signatures:

DELETE /v2/cars/:carId *where carId is an integer*

DELETE /v2/cars/:carMake *where carMake is a string*

It appears Strongloop does not handle this well, as it assumes input is always carName and not carId. Maybe it's just bad practice to have two resources like this...

What is a good way around this, or a better design?

Should I proxy calls to these two endpoints with Strongloop, appending query param 'byCarMake'?

/v2/cars/porche?byCarMake=true

Or is the resource location wrong? Could I do:

DELETE /v2/cars/carId/byCarId

Neither of these seem like a good solution. So, according to REST standards, what is the best way to handle something like this?

Matt
  • 5,408
  • 14
  • 52
  • 79

1 Answers1

0

I know nothing about Strongloop but a few about Restful API.

It is a good practice to keep your endpoint URLs lean and the query parameters fit perfectly for filtering/sorting on GET requests. But if the purpose is to delete cars by make I'd say you need something what would be more suited instead of the query parameters.

You could reverse the nouns to give the following endpoint

/v2/makes/:carMakeId/cars/

GET would return all cars for the specified car make

DELETE would delete cars for the specified car make

j3ff
  • 5,719
  • 8
  • 38
  • 51