/api/update/example always throws 404

Issue #7 resolved
Former user created an issue

/* * @Api\Access("public") * @return array / public function getExampleAction() { return ['great'=>'it works!']; }

The problem relies in the registererd middleware: 'before' => 'typo3/cms-frontend/shortcut-and-mountpoint-redirect',

On top, some middlewares have only been introduced in order to execute these hooks, or due to, and are marked for internal use:

  • :file:typo3/cms-core/normalized-params-attribute
  • :file:typo3/cms-backend/legacy-document-template
  • :file:typo3/cms-backend/output-compression
  • :file:typo3/cms-backend/response-headers
  • :file:typo3/cms-frontend/timetracker
  • :file:typo3/cms-frontend/preprocessing
  • :file:typo3/cms-frontend/eid
  • :file:typo3/cms-frontend/content-length-headers
  • :file:typo3/cms-frontend/tsfe
  • :file:typo3/cms-frontend/output-compression
  • :file:typo3/cms-frontend/prepare-tsfe-rendering
  • :file:typo3/cms-frontend/shortcut-and-mountpoint-redirect

As these middlewares are marked as internal, it is recommended not to reference them directly, as these might get removed in TYPO3 v10.

Comments (10)

  1. David Bascom

    Thanks for reporting!
    We have the Api up and running in testsystems from 9 to 11 – so the problem might be related to something else:

    404

    Are you using nnrestapi with TYPO3 in Version 9? And without a composer based installation?
    Please try registering your endpoints using the alternative method described here:

    https://labor.99grad.de/typo3-docs/typo3-nnrestapi/Requests/Requests/05_Prerequisites.html
    Use the Alternative 2: Global registry of a namespace and let me know, if that works for you.

    Middleware-Hooks:

    Yes – correct. They still exist in v11, but we will need to switch to other hooks if this should change.

  2. Robert Rentz

    Mhh, it is not working (TYPO3 10). The problem ist the pageresolver of typo3, that is before your middleware and the typo3 pageresolver thinks, /api/update/* is not an site

    RequestMiddlewares.php

    $pageResolverCallpointNotWorking = [
        'before'    => 'typo3/cms-frontend/shortcut-and-mountpoint-redirect',
        'after'     => 'typo3/cms-frontend/prepare-tsfe-rendering',
    ];
    
    $pageResolverCallpointWorking = [
        'before'    => 'typo3/cms-frontend/page-resolver'
    ];
    

  3. Robert Rentz

    Would it be okay, if i create a merge request ? Some additional settings for rendering language specific links are also missing.

    Greetings

    Robert

  4. David Bascom

    We spent some time the last days trying to reproduce the problem you described and did some “fresh” installations with and without composer-mode of TYPO3 10 LTS with nnrestapi. We still are having difficulties reproducing the problem – it doesn’t seem to be related to the Middleware. Unless of course there are some other extensions conflicting that we don’t have installed.

    Aside of this, we just uploaded a new version (1.3.4) because we discovered some other issues with translation handling in TYPO3 v10. This might not be related to the bug you reported – but we noticed some things that could be worth checking in your installation:

    • Make sure you have created a Root-Page in your installation that contains the neccessary templates and can be accessed by calling your website without any trailing path segment, e.g. “https://www.yoursite.com/” should show some result and not a 404. This page needs to have the “globe” icon in the backend (checkbox “is_siteroot” in the page properties)
    • If you are using localizations (English, French, …) make sure, the root-page also has a translated version (list view, create translation of page). Again, make sure, calling the root-page with the language path (e.g. https://www.yoursite.com/en/) must not end in a 404

  5. David Bascom

    Did you have time to check the settings mentioned above yet?
    I would otherwise set this issue to “resolved” as it does not seem to be a common problem with other installations.

  6. Robert Rentz

    Good morning.

    The settings you mentioned are fine. I do nor understand, why you do not have the problem.

    Nevertheless, i made a composer patch to get it to work. Looking through your branches, you have the setup i need in the dev-middleware branch.

    https://bitbucket.org/99grad-team/nnrestapi/src/0008afe52522c528e59b220a838ceca487c61937/Configuration/RequestMiddlewares.php#lines-23

    You can close the issue, if you want. I do not like patching, but if the current setup works for you, i am fine.

    Greetings

  7. David Bascom

    Just for people searching for an answer to a similar problem with v11:
    Please double-check that you have added a composer.json to the root-folder of your extension. Without the composer.json, nnrestapi can not find the Classes and parse the endpoints methods.

  8. David Bascom

    Resolving because problem could not be reproduced after many more projects created and based nnrestapi. Will open again in case more people report this problem.

  9. Log in to comment