开发者

Do sites often use the same backend API for a public API aswell?

Is it a common practise to use the same API to run a serv开发者_JAVA技巧ices main site as also offered as the public API or is it more common to develop them separate?

In theory I cant see any reason for them not to be the same just perhaps with different authentication mechanisms and request limitations when accessed publicly.


Nothing for sure but consider the following problems that may arise when using the same set of API

  1. Authentication/authorization (mentioned by you)
  2. Flexibility/maintainability (preserving backward compatibility)
  3. Unnecessary overhead of public API protocols
  4. Not every API operation can/has to be public. You end up with inconsistent API usage
  5. Difference between user (public) model/domain and the one used internally.

That being said I don't believe any site uses their own public API internally (not eating their own dog food).


The public API in most of my site that indeed limits possibilities and functions, does authentication, and then goes to the same internal code the rest uses. A lot easier to keep things consistent troughout, but do version a public api & deprecate features if needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜