When designing an API to be easily consumed by different clients (web and mobile), should I create an end-point for each client?
For example, when trying to create an API for both web and mobile, I was thinking of the following:
- Create the database
- Create the API
- Create the Website to consume the API
- Create the Mobile version to consume the API
In other words, can I create a single API end-point such as this one:
http://site.ne/api/register - for both website and mobile
Or instead, I should create a separate handler for the website, say for eg.
http://site.ne/register.php - website
http://site.ne/api/register - mobile
I believe Facebook, Twitter, etc.. is doing the former. I just want to clear my doubts and fortify my understanding if this is the right thing to do.
Please lead me to some simple examples. If anyone has been buffled with the same before and came out victor, please share your solution.