When designing a RESTful API, should your URI map to tables (for the most part). I have 2 tables that look like this:
Users
+-----------------------------------+
|id|first_name|last_name|email|role |
+-----------------------------------+
|1 |Jonny |Walker |a.com|User |
|2 |Jim |Beam |b.com|User |
|3 |Jack |Daniels |c.com|Admin|
+-----------------------------------+
Availability
+----------------------------+
|user_id|date |status |
+----------------------------+
|1 |2017-06-20|Available|
|1 |2017-06-22|Available|
|1 |2017-06-23|Available|
|2 |2017-06-21|Available|
|3 |2017-06-19|Available|
|3 |2017-06-24|Available|
+----------------------------+
In this case is it better to design the URI like:
www.example.com/users/3/availability/
Or:
www.example.com/users/3
www.example.com/availability/3
When you read it the top makes most sense ("user 3's availability). But it seems that the bottom example would be a better way to separate the availability calendar data from the user data (i.e. first name, last name, email, role).
So my question is should the URI approximately map to the tables like the second URI example?