Should I use my own public API on my site (via JS)?

Posted by newboyhun on Programmers See other posts from Programmers or by newboyhun
Published on 2014-05-27T15:21:58Z Indexed on 2014/05/27 15:56 UTC
Read the original article Hit count: 174

Filed under:
|
|
|

First of all, this question is far more different other 'public api questions' like this: Should a website use its own public API?, second, sorry for my English. You can find the question summarized at the bottom of this question.

What I want to achieve is a big website with a public api, so who like programming (like me) and likes my website, can replicate my website's data with a much better approach (of course with some restrictions).

Almost everything could be used by the public API.

Because of this, I was thinking about making the whole website AJAX driven.

There would be parts of the API which would be limited only to my website (domain), like login, registering.

There would be only an INTERFACE on the client side, which would use the public and private API to make this interface working.

The website would be ONLY CLIENT SIDE, well, I mean, the website would only use AJAX to use the api.


How do I imagine this?

The website would be like a mobile application, the application only sending a request to a webserver, which returns a json, the application parses it, and uses it to advance in the application. (e.g.: login)

My thoughts:

Pros:

  • The whole website is built up by javascript, this means I don't need to transfer the html to the client, saving bandwidth. (I hope so)
  • Anyone can use up the data of my website to make their own cool things. (Is this a con or pro? O_O)
  • The public API is always in use, so I can see if there are any error.

Cons:

  • Without Javascript the website is unusable.
  • The bad guys easily can load the server with requesting too much data (like Request Per Second > 10000), but this can be countered via limiting this with some PHP code and logging.
  • Probably much more work

So the question in some words is: Should I build my website around my own api? Is it good to work only on the client side? Is this good for a big website? (e.x.: facebook, yeah facebook is a different story, but could it run with an 'architecture' like this?)

© Programmers or respective owner

Related posts about php

Related posts about JavaScript