Reputation: 356
If there are 2 usecase for REST Service,
GET
http://localhost:8080/resource/{id}
==> that returns all the
data of the resource as per "id"
So if client requests without "id" path parameter like GET
http://localhost:8080/resource/
then what should be an appropriate
response to this request. Should it be 400 or 404 ?
Please note that there is no Service hosted for GET
http://localhost:8080/resource/
GET
http://localhost:8080/users/{id}/history/
==> that returns
history details of user as per "id"
So if client requests without "id" path parameter like GET
http://localhost:8080/users/history/
then what should be an appropriate
response to this request. Should it be 400 or 404 ?
Please note that there is no Service hosted for GET
http://localhost:8080/users/history/
Upvotes: 1
Views: 1606
Reputation: 57279
So if client requests without "id" path parameter like GET http://localhost:8080/resource/ then what should be an appropriate response to this request. Should it be 400 or 404 ?
404.
Same argument holds for both of your examples.
Upvotes: 1