Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 08 09:27
    cundd labeled #61
  • Jan 02 09:12
    Travis cundd/rest (4.0.0) passed (600)
  • Jan 02 09:11
    Travis cundd/rest (4.0.0) passed (600)
  • Jan 02 09:11
    Travis cundd/rest (4.0.0) passed (600)
  • Jan 02 09:11
    Travis cundd/rest (4.0.0) passed (600)
  • Jan 02 09:11
    Travis cundd/rest (4.0.0) passed (600)
  • Jan 02 09:10
    Travis cundd/rest (4.0.0) passed (600)
  • Jan 02 09:09
    Travis cundd/rest (4.0.0) passed (600)
  • Jan 02 09:09
    Travis cundd/rest (4.0.0) passed (600)
  • Jan 02 09:08
    Travis cundd/rest (4.0.0) passed (600)
  • Jan 02 09:07
    Travis cundd/rest (4.0.0) passed (600)
  • Jan 02 08:55

    cundd on 4.0.0

    (compare)

  • Jan 02 08:55

    cundd on v4

    Raise version number to 4.0.0 (compare)

  • Jan 02 08:34

    cundd on v4

    Fix the Not-Found Custom Rest t… Fix the welcome route when debu… Build the Dockerfile in docker-… and 1 more (compare)

  • Nov 11 2019 16:56

    cundd on v4

    Add additional debugging headers (compare)

  • Nov 08 2019 18:48

    cundd on v4

    Add additional debugging HTTP h… (compare)

  • Nov 08 2019 08:54

    cundd on v4

    Code formatting Breaking change: Prepend the na… (compare)

  • Oct 25 2019 16:58

    cundd on v4

    Style the requirement to transl… (compare)

  • Oct 25 2019 13:36

    cundd on v4

    Mention the requirement to tran… (compare)

  • Oct 13 2019 15:18

    cundd on v4

    Remove invalid names Update the README (compare)

newtypo3user
@newtypo3user
Hi
installed latest typo3, the introduction package and your rest extension on localhost.
Page works fine , but when I call http://localhost/rest I get error 404 Not found
What am I missing? Typo3 is not in a subdirectory
Daniel Corn
@cundd
Apache or Nginx?
newtypo3user
@newtypo3user
apache
Daniel Corn
@cundd
mv _.htaccess .htaccess
I think, the rewriting is not configured yet
TYPO3 may work with http://localhost/index.php?id=1 but not with http://localhost/whatever-url-page-1-has is that correct?
newtypo3user
@newtypo3user
I have only a .htaccess file.
Daniel Corn
@cundd
Is it the one that came with TYPO3?
newtypo3user
@newtypo3user
yes
Daniel Corn
@cundd
Can you tell if the 404 error comes from Apache directly or from TYPO3?
newtypo3user
@newtypo3user
Apache, i see it in the access.log
Daniel Corn
@cundd
Maybe mod_rewrite has to be enabled somewhere else...
Daniel Corn
@cundd
newtypo3user
@newtypo3user
.htaccess was not read by apache. I had to add AllowOverride All to the virtual host now it works.
Daniel Corn
@cundd
:+1: great
R1-FR
@R1-FR
Hi Daniel, thank for your help yesterday ! I have fix the last error.
But now, when i call my URL i have this message {"error":"Forbidden"}. I use customHandler.
So the problem come from the access rights in typoscript ?
Daniel Corn
@cundd
yes
maybe try to make path lowercase
R1-FR
@R1-FR

It's okay ! But now, when i use callExtbasePlugin in my handler, i have this error : The controller \"Process\" is not allowed by plugin \"processlibrary\". Yet I use this plugin on another page and it works.
This is my Handler :

public function configureRoutes(RouterInterface $router, RestRequestInterface $request)
    {
        $router->add(
            Route::get(
                '/Ensci-ensci_material-Process/parent/{slug}/?',
                function (RestRequestInterface $request, $slug) {
                    $arguments = [
                        'parent' => $slug,
                    ];
                    return $this->helper->callExtbasePlugin(
                        'processlibrary',
                        'Ensci',
                        'EnsciProcess',
                        'Process',
                        'parent',
                        $arguments
                    );
                }
            )
        );
    }

And my plugin in ext_localonf.php :

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Ensci.ensci_material',                    // The extension name (in UpperCamelCase) or the extension key (in lower_underscore)
    'processlibrary',                    // A unique name of the plugin in UpperCamelCase
    [                                // An array holding the controller-action-combinations that are accessible 
        'Process' => 'list,process,resources,material,parent',c
    ],
    [
        'Process' => '',
    ]
);
R1-FR
@R1-FR
c is not present in my code ;)
Daniel Corn
@cundd
I think the extension name does not match
in configureRoutes() its "EnsciProcess" but in ext_localconf.php it's "ensci_material"
R1-FR
@R1-FR
That's it ! Thank a lot :)
R1-FR
@R1-FR
Hi Daniel, when i call my url, it's my template comes out and not my array with all the data.
Daniel Corn
@cundd
@R1-FR what's the URL you are calling?
Is there maybe a page that's called rest?
R1-FR
@R1-FR
Daniel Corn
@cundd
do you use realurl or something?
R1-FR
@R1-FR
Yes I use realurl
Daniel Corn
@cundd
Can you check the RealURL tables if there is an entry with /rest? I think RealURL somehow took over that URL
R1-FR
@R1-FR
No URL with /rest.
Daniel Corn
@cundd
Do you get a real page with your template, with some real content?
R1-FR
@R1-FR
Yes
Daniel Corn
@cundd
Is it the 404 page you configured, or the homepage?
R1-FR
@R1-FR
It's the homepage
Daniel Corn
@cundd
Stupid question: Is the REST extension still installed and active?
Maybe try re-installing the extension
R1-FR
@R1-FR

Yes it is :P

I have probably made a mistake in my code, I will try to explain my procedure.
When I call my entire model, everything works, including the display on the page.
When I add the handler, it does not work anymore
this is my path on typoscript file :

Ensci-ensci_material-Process {
            path = Ensci-ensci_material-Process
            read = allow
            write = deny

            handlerClass = \Ensci\EnsciMaterial\Rest\Process
        }

My router in the file Rest/Process.php :

namespace Ensci\EnsciMaterial\Rest;

use Cundd\Rest\Http\RestRequestInterface;
use Cundd\Rest\Router\Route;
use Cundd\Rest\Router\RouterInterface;

class Process implements \Cundd\Rest\Handler\HandlerInterface
{
    /**
     * @var \Ensci\EnsciMaterial\Rest\Helper
     * @inject
     */
    protected $helper;

    public function configureRoutes(RouterInterface $router, RestRequestInterface $request)
    {
        $router->add(
            Route::get(
                '/Ensci-ensci_material-Process/parent/{slug}/?',
                function (RestRequestInterface $request, $slug) {
                    $arguments = [
                        'parent' => $slug,
                    ];
                    return $this->helper->callExtbasePlugin(
                        'processlibrary',
                        'Ensci',
                        'EnsciMaterial',
                        'Process',
                        'process',
                        $arguments
                    );
                }
            )
        );
    }
}

and this is my action in my ProcessController :

/**
     * action process
     *
     * @param int $parent
     * @return void
     */
    public function processAction($parent)
    {
        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
            ->getQueryBuilderForTable('tx_enscimaterial_domain_model_process');
        $queryBuilder
            ->getRestrictions()
            ->removeAll();
        $statement = $queryBuilder
            ->select('*')
            ->from('tx_enscimaterial_domain_model_process')
            ->where(
                $queryBuilder->expr()->eq(
                    'parent', $parent
                )
            )
            ->execute();

        $parents = $statement->fetchAll();

        $this->view->assign('processes', $parents);
    }

And processAction is calling by a template process.html who is calling by a first page with a link on it

Daniel Corn
@cundd
I don't fully understand, but ok :sweat_smile:
If this is the only code in the processAction you could also implement that in the Handler
So you wouldn't have to bootstrap the full Extbase controller
sbumann
@sbumann
@R1-FR welp, if i understood correctly: the handler calls the extbase action, your extbase action's view probably is a fluidtemplate. Your action will respond with a rendered view (rendered html template in this case). try to switch that ViewObject with the JsonView and you would get Json instead of Rendered Html..
R1-FR
@R1-FR
Hi ! Daniel, I implemented processAction in the handler and it works! Tkank you very much for your help and your extension, it's amazing ! 😉
Daniel Corn
@cundd
That's great to hear! :)
Giovanni Romero Pérez
@gromerop
imagen.png
Hi, everybody! I installed and set up the REST extension, but I get the JSON response 'error: "Forbidden"'. I don't know what I have to do. Thank you.
Daniel Corn
@cundd
@gromerop you have to configure the access rules for your resource: https://rest.corn.rest/Configuration/Basic/
Giovanni Romero Pérez
@gromerop
@cundd Yes, I did... I don know if I did it well... I created a template and wrote this in setup:
plugin.tx_rest.settings.paths {
  all {
    path = all
    read = allow
    write = allow
  }
  provider-my_extension-model {
    path = provider-my_extension-model
    read = allow
    write = deny
  }
}
Daniel Corn
@cundd
@gromerop Hmm. That looks correct. You should now at least be able to access yourdomain.abc/rest/provider-my_extension-model
Daniel Corn
@cundd
You can also have a look into the Reports module in the TYPO3 backend. There you'll find an overview of the registered paths