Get UID from relative URL

from documentation i wrote such code for Plone 4.3

from plone import api
uid_about = api.content.get(path='/en/about').UID()

but i can not import api:
"ImportError: cannot import name api"

Please could you give me another way to get UID from a relative URL?
Thank you very much.

You can use restrictedTraverse like:


See for more details

from plone.uuid.interfaces import IUUID
context_uuid = IUUID(context, None)

in later Plone versions:

from plone import api
context_uuid = api.content.get_uuid(obj=context)

Edit/add: the UID is also stored in the portal catalog. Use that if you don't otherwise need to wake up your object.

Plone Foundation Code of Conduct