Question: I have 2 resources User and Album. An user has a list of albums. To get albums there are 2 REST API.

1. `user/{userId}/albums/{albumId}` gets album by albumId. If not found returns 404
2. `user/{userId}/albums` gets all albums by userId. In this case, if a user has no albums, what should be the status code 204 or 404?

Answer: 
Error Code 404
--------------

The web site hosting server will typically generate a "404 Not Found" web page when a user attempts to follow a broken or dead link.

Return Code 204
---------------

The server has fulfilled the request but does not need to return an entity-body.

Conclusion
----------

You obviously need to return a 204 status code. If you use the 404 one, the user may be disturbed. More, you use 404 when the targeted album doesn't exist. Using 404 for both 1 and 2 is illogical.
I agree with the responses, but I think is 204 or 200, it depends of your response when the album list is empty.

If you will return a empty array, the return it with 200 code, if you prefer to don't return anything, then the right one will be 204. (I prefer a 200 with empty list)

Only use 404 with a resource doesn't existis, if it is a empty list the choose 204 or 200.

Good hacking man!