-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build a RESTful API for Piwik #6000
Comments
So module and action should placed like /api/:module/:action and rest of required parameters (most of reports required idSite, date, period) should be set as GET parameters after "?" ? |
It wouldn't be exactly :module/:action I reckon. It be probably rather something like |
RESTful APIs are built around resources so /api/:module/:action would still be RPC. I think something like /users/:id_or_name, /reports/visitsbybrowser or /visits/reports/bybrowser (ie, /:entity/reports/:dimension where reports is a resource related to visits) would work. /api seems unnecessary to me. |
Maybe we can push this for Piwik 3.0. It's related to other powerful ideas:
|
I'm watching this nice writeup video about REST+JSON API design (changed speed to 1.5x 👍 ) there are two types of resources
Behavior is specified using HTTP methods: How to choose the API version?
other best practises mentioned in the video:
|
If someone is not aware of this topic there is also this GitHub project providing a summary and some links to more information: https://github.com/WhiteHouse/api-standards |
from #6158
|
The idea for this would be to write a new plugin on top of the current API. This would bring the advantage that the old API stays untouched / backwards compatible (and maybe we could deprecate it in the next major version 3.0).
Since we want to separate the back end from the front end in the long term having a RESTful API becomes more important.
When we talked about this last week we figured out one of the challenges would be rewriting the URL from
/api/...
to the actual plugin file orindex.php
because not all users are using Apache (easy with .htaccess if rewrite is enabled). Unless we do not find a better solution people will have to modify their server config in case they want to use it.The text was updated successfully, but these errors were encountered: