Ibexa DXP Discussions

Community discussion forum for developers working with Ibexa DXP

Return real content url from external eZ REST API

Hello guys how are you ? I’m consuming an external eZ platform Rest API v2, and I have the content object Id, and I want to get the content real url just but requesting the API. I tried to request GET /content/objects/59 but the returned data does not contain any of the content url.

The problem that the requesting the external API :

GET /content/objects/23 HTTP/1.1
Accept: application/vnd.ez.api.ContentInfo+xml

Return informations about main location, section etc…but not the real url alias.

Any help would be appreciated Thank you.

Hello Ahmed,
well the UrlAlias information is not a part of the content but of its location. In your case you can achieve that using:


custom = true will return all custom Url Aliases (e.g added by the Editor in the UI), false = System generated URLs (In all translations).

Check also my Postman Collection :wink: It will give you a good start.

btw you can also achieve that using GraphQL. You can find an example in the same collection above

1 Like

Hey, thank you for your replay. I really appreciate. Yeah that’s what I’m looking about.

Do you have any idea how the shorter way to get the main location id from content id ?

yes, I’ve added it some minutes ago to the postman collection


You get access to the above link when you send request to /api/ezp/v2/content/objects/72 (see xml or json payload)

btw: You can see also the MainLocation. Pay attention to use the LocationID instead , otherwise you will get always the main URL :wink:

1 Like

Is it possible to specify the siteaccess to use for generating the url alias !

of course:
REST specifying-a-siteaccess
you have to pick up the first UrlAlias.

1 Like

The route responsible for the urlalias:

        path: /content/urlaliases/{urlAliasId}
            _controller: ezpublish_rest.controller.url_alias:loadURLAlias
        methods: [GET]

Does not take into account the siteaccess do so it does not consider the content.tree_root.location_id
I already tried to specify the front siteaccess via the X-Siteaccess header, but still getting the real url of the admin siteaccess. Any idea why ?

GET: /api/ezp/v2/content/locations/1865/urlaliases?custom=false

<?xml version="1.0" encoding="UTF-8"?>
<UrlAliasRefList media-type="application/vnd.ez.api.UrlAliasRefList+xml" href="/api/ezp/v2/content/locations/1865/urlaliases">
    <UrlAlias media-type="application/vnd.ez.api.UrlAlias+xml" href="/api/ezp/v2/content/urlaliases/430-fe725764b6ca74783511fada523e8475"/>

You don’t have to specify X-Siteaccess when it comes to /content/urlaliases/{urlAliasId} . it is enough to get the right {urlAliasId}


< path >/salade-grecque-au-chou-rouge< /path > #french URLAlias


< path >/griechischer-salat-mit-rotkohl< /path > #german UrlALias

Don’t forget the GraphQL support which could resolve easily your problems: https://documenter.getpostman.com/view/1976316/S17wM5gG?version=latest#c8072186-c5b5-467d-a08e-2bf04cd87be8

1 Like