Types

Note

These docs are generated by code tests, therefore you will see some ‘test’ contenttypes appear here.

Available content types in a Plone site can be listed and queried by accessing the /@types endpoint on any context (requires an authenticated user). The ‘addable’ key specifies if the content type can be added to the current context. The ‘layouts’ key specifies the defined views.

http

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

curl

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

httpie

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

python-requests

requests.get('http://nohost/plone/@types', headers={
    'Accept': 'application/json',
}, auth=('admin', 'secret'))
HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "@id": "http://localhost:55001/plone/@types/Collection", 
    "addable": true, 
    "title": "Collection"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/DXTestDocument", 
    "addable": true, 
    "title": "DX Test Document"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/Event", 
    "addable": true, 
    "title": "Event"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/File", 
    "addable": true, 
    "title": "File"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/Folder", 
    "addable": true, 
    "title": "Folder"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/Image", 
    "addable": true, 
    "title": "Image"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/Link", 
    "addable": true, 
    "title": "Link"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/News Item", 
    "addable": true, 
    "title": "News Item"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/Document", 
    "addable": true, 
    "title": "Page"
  }
]

To get the schema of a content type, access the /@types endpoint with the name of the content type, e.g. ‘/plone/@types/Document’:

http

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

curl

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

httpie

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

python-requests

requests.get('http://nohost/plone/@types/Document', headers={
    'Accept': 'application/json',
}, auth=('admin', 'secret'))
HTTP/1.1 200 OK
Content-Type: application/json+schema

{
  "fieldsets": [
    {
      "fields": [
        "title", 
        "description", 
        "text", 
        "changeNote"
      ], 
      "id": "default", 
      "title": "Default"
    }, 
    {
      "fields": [
        "allow_discussion", 
        "exclude_from_nav", 
        "id", 
        "versioning_enabled", 
        "table_of_contents"
      ], 
      "id": "settings", 
      "title": "Settings"
    }, 
    {
      "fields": [
        "subjects", 
        "language", 
        "relatedItems"
      ], 
      "id": "categorization", 
      "title": "Categorization"
    }, 
    {
      "fields": [
        "effective", 
        "expires"
      ], 
      "id": "dates", 
      "title": "Dates"
    }, 
    {
      "fields": [
        "creators", 
        "contributors", 
        "rights"
      ], 
      "id": "ownership", 
      "title": "Ownership"
    }
  ], 
  "layouts": [
    "document_view"
  ], 
  "properties": {
    "allow_discussion": {
      "choices": [
        [
          "True", 
          "Yes"
        ], 
        [
          "False", 
          "No"
        ]
      ], 
      "description": "Allow discussion for this content object.", 
      "enum": [
        "True", 
        "False"
      ], 
      "enumNames": [
        "Yes", 
        "No"
      ], 
      "title": "Allow discussion", 
      "type": "string", 
      "vocabulary": {
        "@id": "http://localhost:55001/plone/@sources/allow_discussion"
      }
    }, 
    "changeNote": {
      "description": "Enter a comment that describes the changes you made.", 
      "title": "Change Note", 
      "type": "string"
    }, 
    "contributors": {
      "additionalItems": true, 
      "description": "The names of people that have contributed to this item. Each contributor should be on a separate line.", 
      "items": {
        "description": "", 
        "title": "", 
        "type": "string"
      }, 
      "title": "Contributors", 
      "type": "array", 
      "uniqueItems": true, 
      "widgetOptions": {
        "vocabulary": {
          "@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users"
        }
      }
    }, 
    "creators": {
      "additionalItems": true, 
      "description": "Persons responsible for creating the content of this item. Please enter a list of user names, one per line. The principal creator should come first.", 
      "items": {
        "description": "", 
        "title": "", 
        "type": "string"
      }, 
      "title": "Creators", 
      "type": "array", 
      "uniqueItems": true, 
      "widgetOptions": {
        "vocabulary": {
          "@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users"
        }
      }
    }, 
    "description": {
      "description": "Used in item listings and search results.", 
      "minLength": 0, 
      "title": "Summary", 
      "type": "string", 
      "widget": "textarea"
    }, 
    "effective": {
      "description": "If this date is in the future, the content will not show up in listings and searches until this date.", 
      "title": "Publishing Date", 
      "type": "string", 
      "widget": "datetime"
    }, 
    "exclude_from_nav": {
      "default": false, 
      "description": "If selected, this item will not appear in the navigation tree", 
      "title": "Exclude from navigation", 
      "type": "boolean"
    }, 
    "expires": {
      "description": "When this date is reached, the content will no longer be visible in listings and searches.", 
      "title": "Expiration Date", 
      "type": "string", 
      "widget": "datetime"
    }, 
    "id": {
      "description": "This name will be displayed in the URL.", 
      "title": "Short name", 
      "type": "string"
    }, 
    "language": {
      "default": "en", 
      "description": "", 
      "title": "Language", 
      "type": "string", 
      "vocabulary": {
        "@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.SupportedContentLanguages"
      }
    }, 
    "relatedItems": {
      "additionalItems": true, 
      "default": [], 
      "description": "", 
      "items": {
        "description": "", 
        "title": "Related", 
        "type": "string", 
        "vocabulary": {
          "@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Catalog"
        }
      }, 
      "title": "Related Items", 
      "type": "array", 
      "uniqueItems": true, 
      "widgetOptions": {
        "pattern_options": {
          "recentlyUsed": true
        }, 
        "vocabulary": {
          "@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Catalog"
        }
      }
    }, 
    "rights": {
      "description": "Copyright statement or other rights information on this item.", 
      "minLength": 0, 
      "title": "Rights", 
      "type": "string", 
      "widget": "textarea"
    }, 
    "subjects": {
      "additionalItems": true, 
      "description": "Tags are commonly used for ad-hoc organization of content.", 
      "items": {
        "description": "", 
        "title": "", 
        "type": "string"
      }, 
      "title": "Tags", 
      "type": "array", 
      "uniqueItems": true, 
      "widgetOptions": {
        "vocabulary": {
          "@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Keywords"
        }
      }
    }, 
    "table_of_contents": {
      "description": "If selected, this will show a table of contents at the top of the page.", 
      "title": "Table of contents", 
      "type": "boolean"
    }, 
    "text": {
      "description": "", 
      "title": "Text", 
      "type": "string", 
      "widget": "richtext"
    }, 
    "title": {
      "description": "", 
      "title": "Title", 
      "type": "string"
    }, 
    "versioning_enabled": {
      "default": true, 
      "description": "Enable/disable versioning for this document.", 
      "title": "Versioning enabled", 
      "type": "boolean"
    }
  }, 
  "required": [
    "title"
  ], 
  "title": "Page", 
  "type": "object"
}

The content type schema uses the JSON Schema format. The tagged values for the widgets are also exposed in the the “properties” attribute of the schema.

For Choice fields, their vocabulary or source will be linked to in a vocabulary or querysource property (one or the other, never both):

  • If a querysource property is included, that field is backed by an IQuerysource. In that case, the source’s terms can’t be enumerated, and the terms need to be queried by issuing a request to the linked endpoint and including the user’s search terms in the ?query= parameter.
  • If a vocabulary property is included, the field is backed by a vocabulary or another kind of iterable source. The terms can then be enumerated by issuing a request to the linked endpoint.

See Vocabularies and Sources for details on these endpoints.

See Types Schema for a detailed documentation about the available field types.