Actions

Actions can be configured in the backend. Each actions defines an id, a title and the required permissions 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 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:

GET /@actions HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk

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": [
    {
      "id": "view",
      "title": "View"
    },
    {
      "id": "edit",
      "title": "Edit"
    },
    {
      "id": "folderContents",
      "title": "Contents"
    },
    {
      "id": "history",
      "title": "History"
    },
    {
      "id": "local_roles",
      "title": "Sharing"
    },
    {
      "id": "contentrules",
      "title": "Rules"
    }
  ],
  "site_actions": [
    {
      "id": "sitemap",
      "title": "Sitemap"
    },
    {
      "id": "accessibility",
      "title": "Accessibility"
    },
    {
      "id": "contact",
      "title": "Contact"
    }
  ],
  "object_buttons": [
    {
      "id": "cut",
      "title": "Cut"
    },
    {
      "id": "copy",
      "title": "Copy"
    },
    {
      "id": "paste",
      "title": "Paste"
    },
    {
      "id": "delete",
      "title": "Delete"
    },
    {
      "id": "rename",
      "title": "Rename"
    }
  ],
  "user": [
    {
      "id": "preferences",
      "title": "Preferences"
    },
    {
      "id": "plone_setup",
      "title": "Site Setup"
    },
    {
      "id": "logout",
      "title": "Log out"
    }
  ]
}