I am currently designing the API for an existing PHP application, and to this end am investigating REST as a sensible architectural approach.
I believe I have a reas
There's no reason not to combine these.
api.example.com/user/{user_id}
– return a user representationapi.example.com/channel/{channel_id}
– return a channel representationapi.example.com/user/{user_id}/channels
– return a list of channel representationsapi.example.com/user/{user_id}/channel_list
– return a list of channel ids (or links to their full representations, using the above links)When in doubt, think about how you would display the data to a human user without "API" concerns: a user wants both index pages ({user_id}/channel_list
) and full views ({user_id}/channels
).
Once you have that, just support JSON instead of (or in addition to) HTML as the representation format, and you have REST.