I would like to design an endpoint for an api where client will only get ids in the response payload. e.g. departments/{departmentId}/users/ids, This endpoint will return userIds of all employees who belong to this deparmentId Please let me know if the above endpoint really makes sense as per the rest api standards or there should be some other way
Please let me know if the above endpoint really makes sense as per the rest api standards
Yup, it's perfect. "Any information that can be named can be a resource" (Fielding, 2000).
GET /departments/17/users/ids
200 OK
Content-Type: text/plain
1
2
3
4
5
...
That's fine. If you want to use some other representation (HTML, or JSON, or whatever), that's also fine.
From the perspective of a general purpose component, it's just a document. Transferring documents over a network is what HTTP is for.