Portal Actions

Plone has the concept of configurable actions (called “portal_actions”). Each actions defines an id, a title, the required permissions and a condition that will be checked to decide if the action will be available for a user. Actions are sorted by categories.

Actions can be used to build UI elements that adapt to the available actions. An example is the Plone toolbar where the “object_tabs” (view, edit, folder contents, sharing) and the “user_actions” (login, logout, preferences) are used to display the user only the actions that are allowed for the currently logged in user.

The available actions for the currently logged in user can be retrieved by calling the @actions endpoint on a specific context. This also works for not authenticated users.

Listing available actions

To list the available actions, send a GET request to the @actions’ endpoint on a specific content object:

http

GET /plone/@actions HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0

curl

curl -i http://nohost/plone/@actions -H 'Accept: application/json' --user admin:secret

httpie

http http://nohost/plone/@actions Accept:application/json -a admin:secret

python-requests

requests.get('http://nohost/plone/@actions', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))

The server will respond with a 200 OK status code. The JSON response contains the available actions categories (object, object_buttons, user) on the top level. Each category contains a list of the available actions in that category:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "object": [
    {
      "icon": "", 
      "id": "view", 
      "title": "View"
    }, 
    {
      "icon": "", 
      "id": "edit", 
      "title": "Edit"
    }, 
    {
      "icon": "", 
      "id": "folderContents", 
      "title": "Contents"
    }, 
    {
      "icon": "", 
      "id": "history", 
      "title": "History"
    }, 
    {
      "icon": "", 
      "id": "local_roles", 
      "title": "Sharing"
    }
  ], 
  "object_buttons": [
    {
      "icon": "", 
      "id": "cut", 
      "title": "Cut"
    }, 
    {
      "icon": "", 
      "id": "copy", 
      "title": "Copy"
    }, 
    {
      "icon": "", 
      "id": "delete", 
      "title": "Delete"
    }, 
    {
      "icon": "", 
      "id": "rename", 
      "title": "Rename"
    }
  ], 
  "user": [
    {
      "icon": "", 
      "id": "preferences", 
      "title": "Preferences"
    }, 
    {
      "icon": "", 
      "id": "plone_setup", 
      "title": "Site Setup"
    }, 
    {
      "icon": "", 
      "id": "logout", 
      "title": "Log out"
    }
  ]
}

If you want to limit the categories that are retured, pass one or more parameters categories:list, i.e. @action?categories:list=object&categories:list=user.