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

eZREST v2 : Lookup UrlAliases by location do not work ( empty dataset is returned )

    Details

      Description

      Trying to do REST call as described in spec, "1.3.2.11.2 List UrlAliases for location"

      Trying to get UrlAliases for node 62. As you can see, server returns 'UrlAlias' as an empty array

      #################### - Client request BEGIN - #########################
      GET /api/ezp/v2/content/locations/1/2/62/urlaliases HTTP/1.1
      Host: ezpublish5.rhel61.qa.ez.no:8080
      User-Agent: eZ REST QA Tester
      Authorization: Basic YWRtaW46cHVibGlzaA==
      Accept: application/vnd.ez.api.UrlAliasRefList+json
       
       
      ##################### - Client request END - ##########################
      sending to target...done.
      Received from Target:
      ##################### - Target reply BEGIN - ##########################
      HTTP/1.1 200 OK
      Date: Wed, 20 Feb 2013 12:50:17 GMT
      Server: Apache/2.2.15 (Red Hat)
      X-Powered-By: PHP/5.3.3
      Cache-Control: private
      Connection: close
      Transfer-Encoding: chunked
      Content-Type: application/vnd.ez.api.UrlAliasRefList+json
       
      a3
      {"UrlAliasRefList":{"_media-type":"application\/vnd.ez.api.UrlAliasRefList+json","_href":"\/api\/ezp\/v2\/content\/locations\/1\/2\/62\/urlaliases","UrlAlias":[]}}
       
      ###################### - Target reply END - ###########################
      

        Activity

        Hide
        Bertrand Dunogier added a comment -

        Confirmed.

        Show
        Bertrand Dunogier added a comment - Confirmed.
        Hide
        Bertrand Dunogier added a comment - - edited

        Investigated a bit.

        The SQL query generated by the code in Legacy\Content\URLAlias\Handler::listURLAliasesForLocation() sends true as the $custom argument for Legacy\Content\UrlAlias\Gateway::loadLocationEntries(). The result is that is_alias where value is set to 0 in this method, failing to retrieve the main url alias for the entry.

        There may be an issue with the expected value, but I need to test it a bit further.

        Show
        Bertrand Dunogier added a comment - - edited Investigated a bit. The SQL query generated by the code in Legacy\Content\URLAlias\Handler::listURLAliasesForLocation() sends true as the $custom argument for Legacy\Content\UrlAlias\Gateway::loadLocationEntries() . The result is that is_alias where value is set to 0 in this method, failing to retrieve the main url alias for the entry. There may be an issue with the expected value, but I need to test it a bit further.
        Hide
        Bertrand Dunogier added a comment -

        The issue is indeed with the custom argument. But it works as documented: https://github.com/bdunogier/ezp-next/blob/rest-csrf/doc/specifications/rest/REST-API-V2.rst#132112list-urlaliases-for-location.

        Parameters:
        custom: (default true) this flag indicates wether autogenerated (false) or manual url aliases (true) should be returned.

        The custom parameter has the value true by default. And custom = true means that you only get custom url aliases, e.g. not the automatically generated ones.

        http -a admin:publish GET "http://vm.ezpublish5/api/ezp/v2/content/locations/1/2/2787/urlaliases?custom=false"    HTTP/1.1 200 OK
        Cache-Control: no-cache
        Content-Type: application/vnd.ez.api.UrlAliasRefList+xml
        Date: Wed, 20 Feb 2013 14:51:26 GMT
        Server: Apache/2.2.22 (Ubuntu)
        Transfer-Encoding: chunked
        X-Debug-Token: 5124e2ef3a532
        X-Powered-By: PHP/5.3.10-1ubuntu3.5
         
        <?xml version="1.0" encoding="UTF-8"?>
        <UrlAliasRefList media-type="application/vnd.ez.api.UrlAliasRefList+xml" href="/api/ezp/v2/content/locations/1/2/2787/urlaliases?custom=false">
         <UrlAlias media-type="application/vnd.ez.api.UrlAlias+xml" href="/api/ezp/v2/content/urlaliases/152-1dc4bd888ef23f8756ee03580edb6fe9"/>
        </UrlAliasRefList>

        Works as expected with custom=false.

        Show
        Bertrand Dunogier added a comment - The issue is indeed with the custom argument. But it works as documented: https://github.com/bdunogier/ezp-next/blob/rest-csrf/doc/specifications/rest/REST-API-V2.rst#132112list-urlaliases-for-location . Parameters: custom: (default true) this flag indicates wether autogenerated (false) or manual url aliases (true) should be returned. The custom parameter has the value true by default. And custom = true means that you only get custom url aliases, e.g. not the automatically generated ones. http -a admin:publish GET "http://vm.ezpublish5/api/ezp/v2/content/locations/1/2/2787/urlaliases?custom=false" HTTP/1.1 200 OK Cache-Control: no-cache Content-Type: application/vnd.ez.api.UrlAliasRefList+xml Date: Wed, 20 Feb 2013 14:51:26 GMT Server: Apache/2.2.22 (Ubuntu) Transfer-Encoding: chunked X-Debug-Token: 5124e2ef3a532 X-Powered-By: PHP/5.3.10-1ubuntu3.5   <?xml version="1.0" encoding="UTF-8"?> <UrlAliasRefList media-type="application/vnd.ez.api.UrlAliasRefList+xml" href="/api/ezp/v2/content/locations/1/2/2787/urlaliases?custom=false"> <UrlAlias media-type="application/vnd.ez.api.UrlAlias+xml" href="/api/ezp/v2/content/urlaliases/152-1dc4bd888ef23f8756ee03580edb6fe9"/> </UrlAliasRefList> Works as expected with custom=false .
        Hide
        Vidar Langseid added a comment -

        Confirmed working. Thanx

        Show
        Vidar Langseid added a comment - Confirmed working. Thanx

          People

          • Assignee:
            Unassigned
            Reporter:
            Vidar Langseid
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: