Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23016

Custom REST API routes (v2) are not accessible from the legacy backend

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: High High
    • Resolution: Obsolete
    • Affects Version/s: 5.3, 2014.05, 5.4.0
    • Fix Version/s: None
    • Component/s: Platform > REST API v2
    • Labels:
    • Environment:

      eZ Publish Community 2014.05, nginx

      Description

      I have extended the REST API as described in the official documentation, and I can access my newly created API route from my frontend siteaccess, so e.g.

      http://frontend.ezpublish.local/api/ezp/v2/my_rest_bundle/hello

      When I call the same route from the legacy backend

      http://backend.ezpublish.local/api/ezp/v2/my_rest_bundle/hello

      I get a kernel(20) error page.

      The default REST API routes provided by eZ Publish out of the box work, so e.g.

      http://frontend.ezpublish.local/api/ezp/v2/content/types
      and
      http://backend.ezpublish.local/api/ezp/v2/content/types

      both return the expected result.

      I would like to be able to access my custom REST API from the legacy backend, too.

        Issue Links

          Activity

          Jérôme Gamez created issue -
          Jérôme Gamez made changes -
          Field Original Value New Value
          Description Frontend: http://www.ezp.local
          Backend (LS): http://cms.ezp.local

          I have extended the REST API as described in the [official documentation|https://doc.ez.no/display/EZP/Extending+the+REST+API], and I can access my newly created API route from my frontend siteaccess, so e.g.

          http://frontend.ezpublish.local/api/ezp/v2/my_rest_bundle/hello

          When I call the same route from the legacy backend

          http://backend.ezpublish.local/api/ezp/v2/my_rest_bundle/hello

          I get a kernel(20) error page.

          The default REST API routes provided by eZ Publish out of the box work, so e.g.

          http://frontend.ezpublish.local/api/ezp/v2/content/types
          and
          http://backend.ezpublish.local/api/ezp/v2/content/types

          both return the expected result.

          I would like to be able to access my custom REST API from the legacy backend, too.
          I have extended the REST API as described in the [official documentation|https://doc.ez.no/display/EZP/Extending+the+REST+API], and I can access my newly created API route from my frontend siteaccess, so e.g.

          http://frontend.ezpublish.local/api/ezp/v2/my_rest_bundle/hello

          When I call the same route from the legacy backend

          http://backend.ezpublish.local/api/ezp/v2/my_rest_bundle/hello

          I get a kernel(20) error page.

          The default REST API routes provided by eZ Publish out of the box work, so e.g.

          http://frontend.ezpublish.local/api/ezp/v2/content/types
          and
          http://backend.ezpublish.local/api/ezp/v2/content/types

          both return the expected result.

          I would like to be able to access my custom REST API from the legacy backend, too.
          Jérôme Gamez made changes -
          Summary Custom REST API routes are not accessible from the legacy backend Custom REST API routes (v2) are not accessible from the legacy backend
          Hide
          Jérôme Gamez added a comment - - edited

          I finally found the reason: for a REST route to be recognized from the legacy backend, it MUST be prefixed with ezpublish_rest_, so, in your routing_rest.yml, this will not work:

          my_custom_bundle_rest_route:
              pattern: /customroute
              defaults:
                  _controller: my_custom_bundle.rest.controller.action:getStuff
              methods: [GET]
          

          but this will:

          ezpublish_rest_my_custom_bundle_rest_route:
              pattern: /customroute
              defaults:
                  _controller: my_custom_bundle.rest.controller.action:getStuff
              methods: [GET]
          

          Show
          Jérôme Gamez added a comment - - edited I finally found the reason: for a REST route to be recognized from the legacy backend, it MUST be prefixed with ezpublish_rest_ , so, in your routing_rest.yml, this will not work: my_custom_bundle_rest_route: pattern: /customroute defaults: _controller: my_custom_bundle.rest.controller.action:getStuff methods: [GET] but this will: ezpublish_rest_my_custom_bundle_rest_route: pattern: /customroute defaults: _controller: my_custom_bundle.rest.controller.action:getStuff methods: [GET]
          Hide
          Bertrand Dunogier added a comment -

          I finally found the reason: for a REST route to be recognized from the legacy backend

          Hmmm... I'm not sure I understand why. The legacy backend doesn't have to "recognize" rest v2 routes. The symfony router should take care of that.

          I might of course be missing something, but I'm really not sure what...

          Show
          Bertrand Dunogier added a comment - I finally found the reason: for a REST route to be recognized from the legacy backend Hmmm... I'm not sure I understand why. The legacy backend doesn't have to "recognize" rest v2 routes. The symfony router should take care of that. I might of course be missing something, but I'm really not sure what...
          Hide
          Bertrand Dunogier added a comment -

          hah actually, it is because of this check in the router.

          We'd be better of checking the rest prefix, thinking about it.

          Show
          Bertrand Dunogier added a comment - hah actually, it is because of this check in the router . We'd be better of checking the rest prefix, thinking about it.
          Bertrand Dunogier made changes -
          Status Open [ 1 ] Confirmed [ 10037 ]
          Bertrand Dunogier made changes -
          Affects Version/s 5.4.0 [ 13884 ]
          Affects Version/s 5.4.0-beta1 [ 13180 ]
          Affects Version/s 5.4-dev [ 13485 ]
          Bertrand Dunogier made changes -
          Status Confirmed [ 10037 ] Backlog [ 10000 ]
          Bertrand Dunogier made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 14473 ]
          Hide
          Bertrand Dunogier added a comment -
          Show
          Bertrand Dunogier added a comment - Added warning to documentation ( https://doc.ez.no/display/EZP/Extending+the+REST+API#ExtendingtheRESTAPI-Route ).
          André Rømcke made changes -
          Status Backlog [ 10000 ] Closed [ 6 ]
          Resolution Obsolete [ 8 ]
          André Rømcke made changes -
          Workflow eZ Engineering Scrumban Workflow [ 63551 ] EZ* Development Workflow [ 85130 ]
          Bertrand Dunogier made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 14473 ] This issue links to "Page (eZ Documentation)" [ 14473 ]
          Maik Seyring made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15651 ]
          Maik Seyring made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15651 ] This issue links to "Page (eZ Documentation)" [ 15651 ]
          Maik Seyring made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15690 ]
          Maik Seyring made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15690 ] This issue links to "Page (eZ Documentation)" [ 15690 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 14473 ] This issue links to "Page (eZ Documentation)" [ 14473 ]
          Maik Seyring made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15938 ]
          Maik Seyring made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15938 ] This issue links to "Page (eZ Documentation)" [ 15938 ]
          André Rømcke made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15938 ] This issue links to "Page (eZ Documentation)" [ 15938 ]
          André Rømcke made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15938 ] This issue links to "Page (eZ Documentation)" [ 15938 ]
          André Rømcke made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15938 ] This issue links to "Page (eZ Documentation)" [ 15938 ]
          André Rømcke made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15938 ] This issue links to "Page (eZ Documentation)" [ 15938 ]
          André Rømcke made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15938 ] This issue links to "Page (eZ Documentation)" [ 15938 ]
          André Rømcke made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15938 ] This issue links to "Page (eZ Documentation)" [ 15938 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15938 ] This issue links to "Page (eZ Documentation)" [ 15938 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15938 ] This issue links to "Page (eZ Documentation)" [ 15938 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 16421 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 16421 ] This issue links to "Page (eZ Documentation)" [ 16421 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 16421 ] This issue links to "Page (eZ Documentation)" [ 16421 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 16421 ] This issue links to "Page (eZ Documentation)" [ 16421 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 16421 ] This issue links to "Page (eZ Documentation)" [ 16421 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 14473 ] This issue links to "Page (eZ Documentation)" [ 14473 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 15938 ] This issue links to "Page (eZ Documentation)" [ 15938 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 16421 ] This issue links to "Page (eZ Documentation)" [ 16421 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 16421 ] This issue links to "Page (eZ Documentation)" [ 16421 ]
          Dominika Kurek made changes -
          Remote Link This issue links to "Page (eZ Documentation)" [ 16421 ] This issue links to "Page (eZ Documentation)" [ 16421 ]
          Alex Schuster made changes -
          Workflow EZ* Development Workflow [ 85130 ] EZEE Development Workflow [ 123913 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Confirmed Confirmed
          163d 22h 4m 1 Bertrand Dunogier 24/Nov/14 9:10 AM
          Confirmed Confirmed Backlog Backlog
          20s 1 Bertrand Dunogier 24/Nov/14 9:10 AM
          Backlog Backlog Closed Closed
          105d 9h 41m 1 André Rømcke 09/Mar/15 6:51 PM

            People

            • Assignee:
              Unassigned
              Reporter:
              Jérôme Gamez
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: