Get Page Reference Through URL

Hello all,

I’ve been trying to get the XWiki - Document Reference via the related URL, but as I’ve read, it’s not as easy to do that.

There was a suggestion, to access the html - source code of the page in question and then retrieve the xwiki-document reference through the metadata.

However, specifically, I have no clue how to do that in xwiki.

Can someone give me some pointers on how to do that ?

Hello! If you are using XWiki 14.10+, you can use this resolver: StandardURLStringEntityReferenceResolver. If you are using an older version, you can try implementing the class yourself.

More specifically, this is how you’re use the XWiki API to parse an URL and find the EntityReference from it:

https://extensions.xwiki.org/xwiki/bin/view/Extension/URL%20API#HAPIExamples

Now if you mean guessing the reference manually, then see https://www.xwiki.org/xwiki/bin/view/FAQ/How%20can%20I%20get%20the%20reference%20of%20a%20page