Behaviors

Contents

Behaviors#

The @behaviors service lists the behaviors that can be enabled on Dexterity content types. It is available at the site root, and requires the Plone Site Setup: Overview permission, as well as permission to use the REST API.

Use the Content type management service to enable behaviors on a content type, and to change their order.

List behaviors#

Send a GET request to /@behaviors to list every registered behavior.

http

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

curl

curl -i -X GET http://nohost/plone/@behaviors -H "Accept: application/json" --user admin:secret

httpie

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

python-requests

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

The response contains @id, items, and items_total. The items are sorted by name, and each has these properties:

Property

Description

name

Behavior ID, as used in the behaviors of a content type. Behaviors without a short name use their interface identifier.

title

Translated title.

description

Translated description.

fieldsets

The fields the behavior adds to the edit form, by fieldset, each with an id, a title, and the names of its fields. Empty for behaviors that add no fields.

Every behavior is listed once, although it is registered under its name and its interface identifier.

{
  "name": "plone.leadimage",
  "title": "Lead Image",
  "description": "Adds image and image caption fields",
  "fieldsets": [
    {
      "id": "default",
      "title": "Default",
      "fields": ["image", "image_caption"]
    }
  ]
}