I will explain my doubt by throwing an example.
Suppose i am designing an endpoint POST
for student
resource and as part of the POST endpoint i want a teacher
uuid to be passed (apart from other details) which is a mandatory field. So that i can associate the student
to the teacher
. Now if the teacher
resource with the given uuid
is not present in my DB then what should i throw:
400 (Bad request)
404 (Not found).
I think 400
would be the correct thing.
If i had a request like below then i would have thrown 404 like
GET /xyy/teachers/{uuid of a teacher}
.
Correct me if i am wrong. Thanks.