My team and I are coding a REST API, but some concepts are still not fully understood.
In a given resource: objective/{id}/goal where goal is collection
If the consumer tries to reach an objective that doesn't exist, the API will return status code 404, pretty simple.
ex: objective/999 returns 404
For some reason the consumer tries to fetch the goals from this non existing resource:
ex: objective/999/goal returns ?
Which is the most suitable code to return? I have a feeling that this should be a 404 too. Some people are considering another error code, because the API should somehow inform that the parent resource doesn't exist in the first place.