MODX Revolution 3 RESTful API

Hello,
I try to use old documentation for MODX Revo 3 but i got an error message

[2022-06-05 11:06:44] (ERROR @ /home/***/core/src/Revolution/Rest/modRestServiceRequest.php : 118) PHP warning: array_walk_recursive() expects parameter 2 to be a valid callback, class 'modRestServiceRequest' not found

I would like to aks help how to start API?

Grts,
Anton

Check this pull request and issue on github:

1 Like

Tnx for your answer.
I’he fixed revolution/core/src/Revolution/Rest/modRestServiceRequest.php
but now i have new error:

Fatal error: Uncaught Error: Class 'modRestController' not found in /home/***/rest/Controllers/Resources.php:3 Stack trace: #0 /home/***/core/src/Revolution/Rest/modRestService.php(236): require_once() #1 /home/***/core/src/Revolution/Rest/modRestService.php(126): MODX\Revolution\Rest\modRestService->getController() #2 /home/***/rest/index.php(38): MODX\Revolution\Rest\modRestService->process() #3 {main} thrown in /home/***/rest/Controllers/Resources.php on line 3

How to solve it?

Tnx.

Try adding the namespace to the class modRestController in the file Resources.php.
Probably something like:

... extends \MODX\Revolution\Rest\modRestController
1 Like

Tnx a lot! It works!

<?php

class MyControllerResources extends \MODX\Revolution\Rest\modRestController
{
    public $classKey = 'modResource';
    public $defaultSortField = 'id';
    public $defaultSortDirection = 'ASC';
}

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”.