Getting all tags using Modx Rest API?

I am trying to integrate something like Tagger.

I have this for Tags.php as a Controller for the REST API system.

<?php
    class MyControllerTags extends modRestController {
    public $classKey = 'TaggerTag';
    public $defaultSortField = 'sortorder';
    public $defaultSortDirection = 'ASC';
}

When I do http://rest.zadesigns.com/Tags

I get

{"results":[],"total":2}

When I do

http://rest.zadesigns.com/Tags/1

i get
{"success":true,"message":"","object":{"id":1,"tag":"Fun","label":"fun","alias":"fun","group":1,"rank":1},"code":200}

Is there a way for me to get all the results in the first call?

instead of results:

Also… a bit of a side question… how can i get intellisense or type complete / etc. Is there a tutorial or setup for IntelliIDEA or a IDE like that, do i need to run local modx with something like MAMP or a mac server so that I can get access to local php?

thanks!

The table for the Tags has no field sortorder to sort by, so the query fails.
Change it to something else:

<?php
    class MyControllerTags extends modRestController {
    public $classKey = 'TaggerTag';
    public $defaultSortField = 'tag';
    public $defaultSortDirection = 'ASC';
}

first things first.
make sure, to protect post, put and delete methods, before sharing your endpoint!

Bruno, thanks for always having the communities back! Much respect brother!

i added

public function beforePost() { return false; }
public function beforePut() { return false; }
public function beforeDelete() { return false; }

is that what I needed? thanks !

looking good, if you don’t want anyone add,edit,delete tags.

you could maybe do

throw new Exception('Unauthorized', 401);

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.