Relationships not living alone


I have two resources users and devices with a one to many relationship (A user can have multiple device).

I’ve got different endpoints and i’m wondering if they are “ok”

/users // get all users
/users/:id // get one user
/users/:id/devices // get user’s devices
/users/:id/devices/:id // get on device of a user

I don’t have any endpoints for getting all devices or one device and i’m wondering if it’s ok


/users // is ok
/users/:id // is ok
/users/:id/devices // for this endpoint I think you should handle it with what is called « Compound Documents » in the specification.
/users/:id/devices/:id // is not ok, you should use /devices/:id as device is a ressource and must a unique ID

Hope it helps