$_GET parameter values (at least in the get method) could be retrieved with
$this->getProperty('key'). In post/put only
$_POST values could be retrieved with that method.
'?filter[posts_per_page]=10' could be retrieved with the following code and set as limit in the get() method
$filters = $this->getProperty('filters');
$this->$limit = $this->modx->getOption('posts_per_page', $filters, $this->limit);
Everything else could be done with the
modx/
xpdo methods, i.e.
getCollection/getIterator,
getObject etc. A few things are prepared in the
modRestController class and could be extended in your own classes inherited from that class. So please read the class code of
modRestController/modRestService to get inspired. Use a remote debugger on
modRestController and your inherited class, to see how it works live.
A few tipps:
- TVs could be retrieved with $this->object->getTVValue('tvname'), if $this->object is an instance of modResource. This could be set with $classKey='modResource' in the variable declaration part of the class code or in the initialize method.
- You could use $this->modx->runSnippet('snippetname', array('propertyname' => 'value') in your code. The result of the taggerGetResourcesWhere snippet could be used to write an the $c->where() query in the prepareListQueryBeforeCount method.
- $c->prepare();die($c->toSQL()); shows the current database query in the end of the prepareListQueryBeforeCount/prepareListQueryAfterCount methods.
- PhpStorm has a nice RESTful Webservice Tester with a possibility to remote debug your code - if setup properly.
We are all volunteers here and do that for free, so please don't expect a fast answer on every question. And please be kind and post back your result, if you are finished. Maybe you could write a tutorial on this in the docs or in your blog.