Single entry point of the API
It is not practical to have many PHP files. It makes introducing new features too complicated.
There should be a single PHP file to call which would handle all features, including custom commands.
API v1:
-
https://example.org/api-v1.php/article/1!edit
--- state machine operations (good) -
https://example.org/api-v1.php?type=article
--- listings (good) -
https://example.org/api-v1-diagram.php?machine=article&format=png
--- State chart (bad) -
https://example.org/api-v1-selfcheck.php
--- Self-check (bad)
API v2:
-
https://example.org/api-v2.php/ref/article/1!edit
--- state machine operations -
https://example.org/api-v2.php/list?type=article
--- listings -
https://example.org/api-v2.php/graph/article.png
--- State chart -
https://example.org/api-v2.php/session
--- reference to session state machine -
https://example.org/api-v2.php/selfcheck
--- self-check