GitHub-only

WARNING: If you are reading this on GitHub, DON’T! Read the documentation at docs.plone.org so you have working references and proper formatting.

List of all API methods with descriptions

api.portal

api.portal.get()

Get the Plone portal object out of thin air.

api.portal.get_navigation_root([context])

Get the navigation root object for the context.

api.portal.get_tool([name])

Get a portal tool in a simple way.

api.portal.get_localized_time([datetime, ...])

Display a date/time in a user-friendly way.

api.portal.send_email([sender, recipient, ...])

Send an email.

api.portal.show_message([message, request, type])

Display a status message.

api.portal.get_registry_record([name, ...])

Get a record value from plone.app.registry

api.content

api.content.get([path, UID])

Get an object.

api.content.create([container, type, id, ...])

Create a new content item.

api.content.delete([obj, objects, ...])

Delete the object(s).

api.content.copy([source, target, id, safe_id])

Copy the object to the target container.

api.content.move([source, target, id, safe_id])

Move the object to the target container.

api.content.rename([obj, new_id, safe_id])

Rename the object.

api.content.get_uuid([obj])

Get the object's Universally Unique IDentifier (UUID).

api.content.get_state([obj, default])

Get the current workflow state of the object.

api.content.transition([obj, transition, ...])

Perform a workflow transition for the object or attempt to perform workflow transitions on the object to reach the given state.

api.content.get_view([name, context, request])

Get a BrowserView object.

api.user

api.user.get([userid, username])

Get a user.

api.user.create([email, username, password, ...])

Create a user.

api.user.delete([username, user])

Delete a user.

api.user.get_current()

Get the currently logged-in user.

api.user.is_anonymous()

Check if the currently logged-in user is anonymous.

api.user.get_users([groupname, group])

Get all users or all users filtered by group.

api.user.get_roles([username, user, obj, ...])

Get user's site-wide or local roles.

api.user.get_permissions([username, user, obj])

Get user's site-wide or local permissions.

api.user.grant_roles([username, user, obj, ...])

Grant roles to a user.

api.user.revoke_roles([username, user, obj, ...])

Revoke roles from a user.

api.group

api.group.get([groupname])

Get a group.

api.group.create([groupname, title, ...])

Create a group.

api.group.delete([groupname, group])

Delete a group.

api.group.add_user([groupname, group, ...])

Add the user to a group.

api.group.remove_user([groupname, group, ...])

Remove the user from a group.

api.group.get_groups([username, user])

Get all groups or all groups filtered by user.

api.group.get_roles([groupname, group, obj, ...])

Get group's site-wide or local roles.

api.group.grant_roles([groupname, group, ...])

Grant roles to a group.

api.group.revoke_roles([groupname, group, ...])

Revoke roles from a group.

api.env

api.env.adopt_roles([roles])

Context manager for temporarily switching roles.

api.env.adopt_user([username, user])

Context manager for temporarily switching user inside a block.

api.env.debug_mode()

Returns True if your zope instance is running in debug mode.

api.env.test_mode()

Returns True if you are running the zope test runner.

Exceptions and errors

api.exc.PloneApiError

Base exception class for plone.api errors.

api.exc.MissingParameterError

Raised when a parameter is missing.

api.exc.InvalidParameterError

Raised when a parameter is invalid.

api.exc.CannotGetPortalError

Raised when the portal object cannot be retrieved.