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: 
When you ask for a specific resource, say a user, and the user doesn't exist, then you should return 404. For example, you have an API to retrieve a user using the following URL:

```
https://yourdomain.com/api/users/:userid

```

and a request is made to retrieve user 1234, that doesn't exist, then you should return 404. In this case, the client requested a resource that doesn't exist.

```
https://yourdomain.com/api/users/1234 
404

```

Now suppose you have an api that returns all users in the system using the following url:

```
https://yourdomain.com/api/users

```

If there are no users in the system, then, in this case, you should return 204.
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!