Types#
Note
These docs are generated by code tests, therefore you will see some test
content types appear here.
Available content types in a Plone site can be listed and queried by accessing the /@types
endpoint on any context.
Access 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:
GET /plone/@types HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
curl -i -X GET http://nohost/plone/@types -H "Accept: application/json" --user admin:secret
http http://nohost/plone/@types Accept:application/json -a admin:secret
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,
"id": "Collection",
"immediately_addable": true,
"title": "Collection"
},
{
"@id": "http://localhost:55001/plone/@types/DXTestDocument",
"addable": true,
"id": "DXTestDocument",
"immediately_addable": true,
"title": "DX Test Document"
},
{
"@id": "http://localhost:55001/plone/@types/Event",
"addable": true,
"id": "Event",
"immediately_addable": true,
"title": "Event"
},
{
"@id": "http://localhost:55001/plone/@types/File",
"addable": true,
"id": "File",
"immediately_addable": true,
"title": "File"
},
{
"@id": "http://localhost:55001/plone/@types/Folder",
"addable": true,
"id": "Folder",
"immediately_addable": true,
"title": "Folder"
},
{
"@id": "http://localhost:55001/plone/@types/Image",
"addable": true,
"id": "Image",
"immediately_addable": true,
"title": "Image"
},
{
"@id": "http://localhost:55001/plone/@types/Link",
"addable": true,
"id": "Link",
"immediately_addable": true,
"title": "Link"
},
{
"@id": "http://localhost:55001/plone/@types/News Item",
"addable": true,
"id": "News Item",
"immediately_addable": true,
"title": "News Item"
},
{
"@id": "http://localhost:55001/plone/@types/Document",
"addable": true,
"id": "Document",
"immediately_addable": true,
"title": "Page"
}
]
The API consumer can create, read, update, and delete a content types schema.
Verb |
URL |
Action |
---|---|---|
|
|
Add field/fieldset to content type schema |
|
|
Get the schema of a content type |
|
|
Update existing schema fields/fieldsets properties |
|
|
Replace content-type schema |
In addition to the above methods we can also do:
Verb |
URL |
Action |
---|---|---|
|
|
Get field/fieldset properties |
|
|
Update field/fieldset properties |
|
|
Remove field/fieldset from schema |
Note
Schema fields and fieldsets defined by behaviors are immutable and can NOT be changed via this RestAPI endpoint. See Dexterity Types control panel RestAPI endpoint for enabling and disabling behaviors.
Add schema fieldset or field with POST
#
To create a new fieldset, send a POST
request to the /@types/Document
endpoint:
POST /plone/@types/Document HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json
{
"description": "Contact information",
"factory": "fieldset",
"title": "Contact Info"
}
curl -i -X POST http://nohost/plone/@types/Document -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"description": "Contact information", "factory": "fieldset", "title": "Contact Info"}' --user admin:secret
echo '{
"description": "Contact information",
"factory": "fieldset",
"title": "Contact Info"
}' | http POST http://nohost/plone/@types/Document Accept:application/json Content-Type:application/json -a admin:secret
requests.post('http://nohost/plone/@types/Document', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'description': 'Contact information', 'factory': 'fieldset', 'title': 'Contact Info'}, auth=('admin', 'secret'))
Response:
HTTP/1.1 201 Created
Content-Type: application/json
{
"behavior": "plone.dexterity.schema.generated",
"description": "Contact information",
"fields": [],
"id": "contact_info",
"title": "Contact Info"
}
To create a new field, send a POST
request to the /@types/Document
endpoint:
POST /plone/@types/Document HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json
{
"description": "Email of the author",
"factory": "Email",
"required": true,
"title": "Author email"
}
curl -i -X POST http://nohost/plone/@types/Document -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"description": "Email of the author", "factory": "Email", "required": true, "title": "Author email"}' --user admin:secret
echo '{
"description": "Email of the author",
"factory": "Email",
"required": true,
"title": "Author email"
}' | http POST http://nohost/plone/@types/Document Accept:application/json Content-Type:application/json -a admin:secret
requests.post('http://nohost/plone/@types/Document', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'description': 'Email of the author', 'factory': 'Email', 'required': True, 'title': 'Author email'}, auth=('admin', 'secret'))
Response:
HTTP/1.1 201 Created
Content-Type: application/json
{
"behavior": "plone.dexterity.schema.generated.plone_5_1234567890_2_123456_0_Document",
"description": "Email of the author",
"factory": "Email",
"title": "Author email",
"type": "string",
"widget": "email"
}
For a complete list of available field @types
, you can access /@vocabularies/Fields
endpoint:
GET /plone/@vocabularies/Fields HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
curl -i -X GET http://nohost/plone/@vocabularies/Fields -H "Accept: application/json" --user admin:secret
http http://nohost/plone/@vocabularies/Fields Accept:application/json -a admin:secret
requests.get('http://nohost/plone/@vocabularies/Fields', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
Response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:55001/plone/@vocabularies/Fields",
"items": [
{
"title": "Choice",
"token": "label_choice_field"
},
{
"title": "Date",
"token": "label_date_field"
},
{
"title": "Date/Time",
"token": "label_datetime_field"
},
{
"title": "Email",
"token": "Email"
},
{
"title": "Email",
"token": "label_email"
},
{
"title": "File Upload",
"token": "File Upload"
},
{
"title": "Floating-point number",
"token": "label_float_field"
},
{
"title": "Full Name",
"token": "label_full_name"
},
{
"title": "Image",
"token": "Image"
},
{
"title": "Integer",
"token": "label_integer_field"
},
{
"title": "JSONField",
"token": "JSONField"
},
{
"title": "Multiple Choice",
"token": "label_multi_choice_field"
},
{
"title": "Password",
"token": "label_password_field"
},
{
"title": "Relation Choice",
"token": "Relation Choice"
},
{
"title": "Relation List",
"token": "Relation List"
},
{
"title": "Rich Text",
"token": "Rich Text"
},
{
"title": "Text",
"token": "label_text_field"
},
{
"title": "Text line (String)",
"token": "label_textline_field"
},
{
"title": "URL",
"token": "URL"
},
{
"title": "Yes/No",
"token": "label_boolean_field"
}
],
"items_total": 20
}
Get the schema with GET
#
To get the schema of a content type, access the /@types
endpoint with the name of the content type, for example, plone/@types/Document
:
GET /plone/@types/Document HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
curl -i -X GET http://nohost/plone/@types/Document -H "Accept: application/json" --user admin:secret
http http://nohost/plone/@types/Document Accept:application/json -a admin:secret
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": [
{
"behavior": "plone",
"fields": [
"title",
"description",
"author_email",
"text",
"changeNote"
],
"id": "default",
"title": "Default"
},
{
"behavior": "plone",
"description": "",
"fields": [
"allow_discussion",
"exclude_from_nav",
"id",
"versioning_enabled",
"table_of_contents"
],
"id": "settings",
"title": "Settings"
},
{
"behavior": "plone",
"description": "",
"fields": [
"subjects",
"language",
"relatedItems"
],
"id": "categorization",
"title": "Categorization"
},
{
"behavior": "plone",
"description": "",
"fields": [
"effective",
"expires"
],
"id": "dates",
"title": "Dates"
},
{
"behavior": "plone",
"description": "",
"fields": [
"creators",
"contributors",
"rights"
],
"id": "ownership",
"title": "Ownership"
},
{
"behavior": "plone.dexterity.schema.generated",
"description": "Contact information",
"fields": [],
"id": "contact_info",
"title": "Contact Info"
}
],
"layouts": [
"document_view"
],
"properties": {
"allow_discussion": {
"behavior": "plone.allowdiscussion",
"choices": [
[
"True",
"Yes"
],
[
"False",
"No"
]
],
"description": "Allow discussion for this content object.",
"enum": [
"True",
"False"
],
"enumNames": [
"Yes",
"No"
],
"factory": "Choice",
"title": "Allow discussion",
"type": "string",
"vocabulary": {
"@id": "http://localhost:55001/plone/@sources/allow_discussion"
}
},
"author_email": {
"behavior": "plone.dexterity.schema.generated.plone_5_1234567890_2_123456_0_Document",
"description": "Email of the author",
"factory": "Email",
"title": "Author email",
"type": "string",
"widget": "email"
},
"changeNote": {
"behavior": "plone.versioning",
"description": "Enter a comment that describes the changes you made.",
"factory": "Text line (String)",
"title": "Change Note",
"type": "string"
},
"contributors": {
"additionalItems": true,
"behavior": "plone.dublincore",
"description": "The names of people that have contributed to this item. Each contributor should be on a separate line.",
"factory": "Tuple",
"items": {
"description": "",
"factory": "Text line (String)",
"title": "",
"type": "string"
},
"title": "Contributors",
"type": "array",
"uniqueItems": true,
"widgetOptions": {
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users"
}
}
},
"creators": {
"additionalItems": true,
"behavior": "plone.dublincore",
"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.",
"factory": "Tuple",
"items": {
"description": "",
"factory": "Text line (String)",
"title": "",
"type": "string"
},
"title": "Creators",
"type": "array",
"uniqueItems": true,
"widgetOptions": {
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users"
}
}
},
"description": {
"behavior": "plone.dublincore",
"description": "Used in item listings and search results.",
"factory": "Text",
"title": "Summary",
"type": "string",
"widget": "textarea"
},
"effective": {
"behavior": "plone.dublincore",
"description": "If this date is in the future, the content will not show up in listings and searches until this date.",
"factory": "Date/Time",
"title": "Publishing Date",
"type": "string",
"widget": "datetime"
},
"exclude_from_nav": {
"behavior": "plone.excludefromnavigation",
"default": false,
"description": "If selected, this item will not appear in the navigation tree",
"factory": "Yes/No",
"title": "Exclude from navigation",
"type": "boolean"
},
"expires": {
"behavior": "plone.dublincore",
"description": "When this date is reached, the content will no longer be visible in listings and searches.",
"factory": "Date/Time",
"title": "Expiration Date",
"type": "string",
"widget": "datetime"
},
"id": {
"behavior": "plone.shortname",
"description": "This name will be displayed in the URL.",
"factory": "Text line (String)",
"title": "Short name",
"type": "string"
},
"language": {
"behavior": "plone.dublincore",
"default": "en",
"description": "",
"factory": "Choice",
"title": "Language",
"type": "string",
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.SupportedContentLanguages"
}
},
"relatedItems": {
"additionalItems": true,
"behavior": "plone.relateditems",
"default": [],
"description": "",
"factory": "Relation List",
"items": {
"description": "",
"factory": "Relation Choice",
"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": {
"behavior": "plone.dublincore",
"description": "Copyright statement or other rights information on this item.",
"factory": "Text",
"title": "Rights",
"type": "string",
"widget": "textarea"
},
"subjects": {
"additionalItems": true,
"behavior": "plone.dublincore",
"description": "Tags are commonly used for ad-hoc organization of content.",
"factory": "Tuple",
"items": {
"description": "",
"factory": "Text line (String)",
"title": "",
"type": "string"
},
"title": "Tags",
"type": "array",
"uniqueItems": true,
"widgetOptions": {
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Keywords"
}
}
},
"table_of_contents": {
"behavior": "plone.tableofcontents",
"description": "If selected, this will show a table of contents at the top of the page.",
"factory": "Yes/No",
"title": "Table of contents",
"type": "boolean"
},
"text": {
"behavior": "plone.richtext",
"description": "",
"factory": "Rich Text",
"title": "Text",
"type": "string",
"widget": "richtext"
},
"title": {
"behavior": "plone.dublincore",
"description": "",
"factory": "Text line (String)",
"title": "Title",
"type": "string"
},
"versioning_enabled": {
"behavior": "plone.versioning",
"default": true,
"description": "Enable/disable versioning for this document.",
"factory": "Yes/No",
"title": "Versioning enabled",
"type": "boolean"
}
},
"required": [
"title",
"author_email"
],
"title": "Page",
"type": "object"
}
The content type schema uses the JSON Schema format.
The tagged values for the widgets are also exposed in 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 anIQuerysource
. In that case, the source's terms can't be enumerated. 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.
To get one schema fieldset properties, access @types/Document/{fieldset}
endpoint:
GET /plone/@types/Document/contact_info HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
curl -i -X GET http://nohost/plone/@types/Document/contact_info -H "Accept: application/json" --user admin:secret
http http://nohost/plone/@types/Document/contact_info Accept:application/json -a admin:secret
requests.get('http://nohost/plone/@types/Document/contact_info', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
HTTP/1.1 200 OK
Content-Type: application/json
{
"behavior": "plone.dexterity.schema.generated",
"description": "Contact information",
"fields": [],
"id": "contact_info",
"title": "Contact Info"
}
To get one schema field properties, access @types/Document/{field}
endpoint:
GET /plone/@types/Document/author_email HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
curl -i -X GET http://nohost/plone/@types/Document/author_email -H "Accept: application/json" --user admin:secret
http http://nohost/plone/@types/Document/author_email Accept:application/json -a admin:secret
requests.get('http://nohost/plone/@types/Document/author_email', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
HTTP/1.1 200 OK
Content-Type: application/json
{
"behavior": "plone.dexterity.schema.generated.plone_5_1234567890_2_123456_0_Document",
"description": "Email of the author",
"factory": "Email",
"title": "Author email",
"type": "string",
"widget": "email"
}
Update schema with PATCH
#
To update content type schema defaults, we send a PATCH
request to the server.
PATCH
allows to provide just a subset of the resource, that is, the values you actually want to change.
To update one or more schema field properties:
PATCH /plone/@types/Document HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json
{
"properties": {
"author_email": {
"default": "foo@bar.com",
"maxLength": 20,
"minLength": 5
}
}
}
curl -i -X PATCH http://nohost/plone/@types/Document -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"properties": {"author_email": {"default": "foo@bar.com", "maxLength": 20, "minLength": 5}}}' --user admin:secret
echo '{
"properties": {
"author_email": {
"default": "foo@bar.com",
"maxLength": 20,
"minLength": 5
}
}
}' | http PATCH http://nohost/plone/@types/Document Accept:application/json Content-Type:application/json -a admin:secret
requests.patch('http://nohost/plone/@types/Document', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'properties': {'author_email': {'default': 'foo@bar.com', 'maxLength': 20, 'minLength': 5}}}, auth=('admin', 'secret'))
Response:
HTTP/1.1 204 No Content
To change one or more fieldset properties:
PATCH /plone/@types/Document HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json
{
"fieldsets": [
{
"fields": [
"author_email"
],
"id": "contact_info",
"title": "Contact info"
}
]
}
curl -i -X PATCH http://nohost/plone/@types/Document -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"fieldsets": [{"fields": ["author_email"], "id": "contact_info", "title": "Contact info"}]}' --user admin:secret
echo '{
"fieldsets": [
{
"fields": [
"author_email"
],
"id": "contact_info",
"title": "Contact info"
}
]
}' | http PATCH http://nohost/plone/@types/Document Accept:application/json Content-Type:application/json -a admin:secret
requests.patch('http://nohost/plone/@types/Document', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'fieldsets': [{'fields': ['author_email'], 'id': 'contact_info', 'title': 'Contact info'}]}, auth=('admin', 'secret'))
Response:
HTTP/1.1 204 No Content
To update one fieldset settings, we can also send a PATCH
request to @types/Document/{fieldset}
endpoint:
PATCH /plone/@types/Document/contact_info HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json
{
"description": "Contact information",
"fields": [
"author_email"
],
"title": "Contact information"
}
curl -i -X PATCH http://nohost/plone/@types/Document/contact_info -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"description": "Contact information", "fields": ["author_email"], "title": "Contact information"}' --user admin:secret
echo '{
"description": "Contact information",
"fields": [
"author_email"
],
"title": "Contact information"
}' | http PATCH http://nohost/plone/@types/Document/contact_info Accept:application/json Content-Type:application/json -a admin:secret
requests.patch('http://nohost/plone/@types/Document/contact_info', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'description': 'Contact information', 'fields': ['author_email'], 'title': 'Contact information'}, auth=('admin', 'secret'))
Response:
HTTP/1.1 204 No Content
To update one field settings, we can also send a PATCH
request to @types/Document/{field}
endpoint:
PATCH /plone/@types/Document/author_email HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json
{
"description": "The e-mail address of the author",
"maxLength": 20,
"minLength": 10,
"required": true,
"title": "Author e-mail"
}
curl -i -X PATCH http://nohost/plone/@types/Document/author_email -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"description": "The e-mail address of the author", "maxLength": 20, "minLength": 10, "required": true, "title": "Author e-mail"}' --user admin:secret
echo '{
"description": "The e-mail address of the author",
"maxLength": 20,
"minLength": 10,
"required": true,
"title": "Author e-mail"
}' | http PATCH http://nohost/plone/@types/Document/author_email Accept:application/json Content-Type:application/json -a admin:secret
requests.patch('http://nohost/plone/@types/Document/author_email', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'description': 'The e-mail address of the author', 'maxLength': 20, 'minLength': 10, 'required': True, 'title': 'Author e-mail'}, auth=('admin', 'secret'))
Response:
HTTP/1.1 204 No Content
Update schema with PUT
#
Use PUT
when more changes are needed in one call, such as creating new fields or fieldsets, moving fields to a fieldset, removing multiple fields, and so on:
PUT /plone/@types/Document HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json
{
"fieldsets": [
{
"fields": [
"author_email",
"author_url",
"author_name"
],
"id": "author",
"title": "Contact the author"
},
{
"fields": [],
"id": "contact_info",
"title": "Contact info"
}
],
"layouts": [
"thumbnail_view",
"table_view"
],
"properties": {
"allow_discussion": {
"behavior": "plone.allowdiscussion",
"choices": [
[
"True",
"Yes"
],
[
"False",
"No"
]
],
"description": "Allow discussion for this content object.",
"enum": [
"True",
"False"
],
"enumNames": [
"Yes",
"No"
],
"factory": "Choice",
"title": "Allow discussion",
"type": "string",
"vocabulary": {
"@id": "http://localhost:55001/plone/@sources/allow_discussion"
}
},
"author_email": {
"behavior": "plone.dexterity.schema.generated.plone_5_1234567890_2_123456_0_Document",
"description": "Email of the author",
"factory": "Email",
"title": "Author email",
"type": "string",
"widget": "email"
},
"author_name": {
"description": "Name of the author",
"factory": "Text line (String)",
"title": "Author name"
},
"author_url": {
"description": "Author webpage",
"factory": "URL",
"maxLength": 30,
"minLength": 5,
"title": "Author website"
},
"changeNote": {
"behavior": "plone.versioning",
"description": "Enter a comment that describes the changes you made.",
"factory": "Text line (String)",
"title": "Change Note",
"type": "string"
},
"contributors": {
"additionalItems": true,
"behavior": "plone.dublincore",
"description": "The names of people that have contributed to this item. Each contributor should be on a separate line.",
"factory": "Tuple",
"items": {
"description": "",
"factory": "Text line (String)",
"title": "",
"type": "string"
},
"title": "Contributors",
"type": "array",
"uniqueItems": true,
"widgetOptions": {
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users"
}
}
},
"creators": {
"additionalItems": true,
"behavior": "plone.dublincore",
"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.",
"factory": "Tuple",
"items": {
"description": "",
"factory": "Text line (String)",
"title": "",
"type": "string"
},
"title": "Creators",
"type": "array",
"uniqueItems": true,
"widgetOptions": {
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users"
}
}
},
"description": {
"behavior": "plone.dublincore",
"description": "Used in item listings and search results.",
"factory": "Text",
"title": "Summary",
"type": "string",
"widget": "textarea"
},
"effective": {
"behavior": "plone.dublincore",
"description": "If this date is in the future, the content will not show up in listings and searches until this date.",
"factory": "Date/Time",
"title": "Publishing Date",
"type": "string",
"widget": "datetime"
},
"exclude_from_nav": {
"behavior": "plone.excludefromnavigation",
"default": false,
"description": "If selected, this item will not appear in the navigation tree",
"factory": "Yes/No",
"title": "Exclude from navigation",
"type": "boolean"
},
"expires": {
"behavior": "plone.dublincore",
"description": "When this date is reached, the content will no longer be visible in listings and searches.",
"factory": "Date/Time",
"title": "Expiration Date",
"type": "string",
"widget": "datetime"
},
"id": {
"behavior": "plone.shortname",
"description": "This name will be displayed in the URL.",
"factory": "Text line (String)",
"title": "Short name",
"type": "string"
},
"language": {
"behavior": "plone.dublincore",
"default": "en",
"description": "",
"factory": "Choice",
"title": "Language",
"type": "string",
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.SupportedContentLanguages"
}
},
"relatedItems": {
"additionalItems": true,
"behavior": "plone.relateditems",
"default": [],
"description": "",
"factory": "Relation List",
"items": {
"description": "",
"factory": "Relation Choice",
"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": {
"behavior": "plone.dublincore",
"description": "Copyright statement or other rights information on this item.",
"factory": "Text",
"title": "Rights",
"type": "string",
"widget": "textarea"
},
"subjects": {
"additionalItems": true,
"behavior": "plone.dublincore",
"description": "Tags are commonly used for ad-hoc organization of content.",
"factory": "Tuple",
"items": {
"description": "",
"factory": "Text line (String)",
"title": "",
"type": "string"
},
"title": "Tags",
"type": "array",
"uniqueItems": true,
"widgetOptions": {
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Keywords"
}
}
},
"table_of_contents": {
"behavior": "plone.tableofcontents",
"description": "If selected, this will show a table of contents at the top of the page.",
"factory": "Yes/No",
"title": "Table of contents",
"type": "boolean"
},
"text": {
"behavior": "plone.richtext",
"description": "",
"factory": "Rich Text",
"title": "Text",
"type": "string",
"widget": "richtext"
},
"title": {
"behavior": "plone.dublincore",
"description": "",
"factory": "Text line (String)",
"title": "Title",
"type": "string"
},
"versioning_enabled": {
"behavior": "plone.versioning",
"default": true,
"description": "Enable/disable versioning for this document.",
"factory": "Yes/No",
"title": "Versioning enabled",
"type": "boolean"
}
},
"required": [
"title",
"author_email"
],
"title": "Page",
"type": "object"
}
curl -i -X PUT http://nohost/plone/@types/Document -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"fieldsets": [{"fields": ["author_email", "author_url", "author_name"], "id": "author", "title": "Contact the author"}, {"fields": [], "id": "contact_info", "title": "Contact info"}], "layouts": ["thumbnail_view", "table_view"], "properties": {"allow_discussion": {"behavior": "plone.allowdiscussion", "choices": [["True", "Yes"], ["False", "No"]], "description": "Allow discussion for this content object.", "enum": ["True", "False"], "enumNames": ["Yes", "No"], "factory": "Choice", "title": "Allow discussion", "type": "string", "vocabulary": {"@id": "http://localhost:55001/plone/@sources/allow_discussion"}}, "author_email": {"behavior": "plone.dexterity.schema.generated.plone_5_1234567890_2_123456_0_Document", "description": "Email of the author", "factory": "Email", "title": "Author email", "type": "string", "widget": "email"}, "author_name": {"description": "Name of the author", "factory": "Text line (String)", "title": "Author name"}, "author_url": {"description": "Author webpage", "factory": "URL", "maxLength": 30, "minLength": 5, "title": "Author website"}, "changeNote": {"behavior": "plone.versioning", "description": "Enter a comment that describes the changes you made.", "factory": "Text line (String)", "title": "Change Note", "type": "string"}, "contributors": {"additionalItems": true, "behavior": "plone.dublincore", "description": "The names of people that have contributed to this item. Each contributor should be on a separate line.", "factory": "Tuple", "items": {"description": "", "factory": "Text line (String)", "title": "", "type": "string"}, "title": "Contributors", "type": "array", "uniqueItems": true, "widgetOptions": {"vocabulary": {"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users"}}}, "creators": {"additionalItems": true, "behavior": "plone.dublincore", "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.", "factory": "Tuple", "items": {"description": "", "factory": "Text line (String)", "title": "", "type": "string"}, "title": "Creators", "type": "array", "uniqueItems": true, "widgetOptions": {"vocabulary": {"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users"}}}, "description": {"behavior": "plone.dublincore", "description": "Used in item listings and search results.", "factory": "Text", "title": "Summary", "type": "string", "widget": "textarea"}, "effective": {"behavior": "plone.dublincore", "description": "If this date is in the future, the content will not show up in listings and searches until this date.", "factory": "Date/Time", "title": "Publishing Date", "type": "string", "widget": "datetime"}, "exclude_from_nav": {"behavior": "plone.excludefromnavigation", "default": false, "description": "If selected, this item will not appear in the navigation tree", "factory": "Yes/No", "title": "Exclude from navigation", "type": "boolean"}, "expires": {"behavior": "plone.dublincore", "description": "When this date is reached, the content will no longer be visible in listings and searches.", "factory": "Date/Time", "title": "Expiration Date", "type": "string", "widget": "datetime"}, "id": {"behavior": "plone.shortname", "description": "This name will be displayed in the URL.", "factory": "Text line (String)", "title": "Short name", "type": "string"}, "language": {"behavior": "plone.dublincore", "default": "en", "description": "", "factory": "Choice", "title": "Language", "type": "string", "vocabulary": {"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.SupportedContentLanguages"}}, "relatedItems": {"additionalItems": true, "behavior": "plone.relateditems", "default": [], "description": "", "factory": "Relation List", "items": {"description": "", "factory": "Relation Choice", "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": {"behavior": "plone.dublincore", "description": "Copyright statement or other rights information on this item.", "factory": "Text", "title": "Rights", "type": "string", "widget": "textarea"}, "subjects": {"additionalItems": true, "behavior": "plone.dublincore", "description": "Tags are commonly used for ad-hoc organization of content.", "factory": "Tuple", "items": {"description": "", "factory": "Text line (String)", "title": "", "type": "string"}, "title": "Tags", "type": "array", "uniqueItems": true, "widgetOptions": {"vocabulary": {"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Keywords"}}}, "table_of_contents": {"behavior": "plone.tableofcontents", "description": "If selected, this will show a table of contents at the top of the page.", "factory": "Yes/No", "title": "Table of contents", "type": "boolean"}, "text": {"behavior": "plone.richtext", "description": "", "factory": "Rich Text", "title": "Text", "type": "string", "widget": "richtext"}, "title": {"behavior": "plone.dublincore", "description": "", "factory": "Text line (String)", "title": "Title", "type": "string"}, "versioning_enabled": {"behavior": "plone.versioning", "default": true, "description": "Enable/disable versioning for this document.", "factory": "Yes/No", "title": "Versioning enabled", "type": "boolean"}}, "required": ["title", "author_email"], "title": "Page", "type": "object"}' --user admin:secret
echo '{
"fieldsets": [
{
"fields": [
"author_email",
"author_url",
"author_name"
],
"id": "author",
"title": "Contact the author"
},
{
"fields": [],
"id": "contact_info",
"title": "Contact info"
}
],
"layouts": [
"thumbnail_view",
"table_view"
],
"properties": {
"allow_discussion": {
"behavior": "plone.allowdiscussion",
"choices": [
[
"True",
"Yes"
],
[
"False",
"No"
]
],
"description": "Allow discussion for this content object.",
"enum": [
"True",
"False"
],
"enumNames": [
"Yes",
"No"
],
"factory": "Choice",
"title": "Allow discussion",
"type": "string",
"vocabulary": {
"@id": "http://localhost:55001/plone/@sources/allow_discussion"
}
},
"author_email": {
"behavior": "plone.dexterity.schema.generated.plone_5_1234567890_2_123456_0_Document",
"description": "Email of the author",
"factory": "Email",
"title": "Author email",
"type": "string",
"widget": "email"
},
"author_name": {
"description": "Name of the author",
"factory": "Text line (String)",
"title": "Author name"
},
"author_url": {
"description": "Author webpage",
"factory": "URL",
"maxLength": 30,
"minLength": 5,
"title": "Author website"
},
"changeNote": {
"behavior": "plone.versioning",
"description": "Enter a comment that describes the changes you made.",
"factory": "Text line (String)",
"title": "Change Note",
"type": "string"
},
"contributors": {
"additionalItems": true,
"behavior": "plone.dublincore",
"description": "The names of people that have contributed to this item. Each contributor should be on a separate line.",
"factory": "Tuple",
"items": {
"description": "",
"factory": "Text line (String)",
"title": "",
"type": "string"
},
"title": "Contributors",
"type": "array",
"uniqueItems": true,
"widgetOptions": {
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users"
}
}
},
"creators": {
"additionalItems": true,
"behavior": "plone.dublincore",
"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.",
"factory": "Tuple",
"items": {
"description": "",
"factory": "Text line (String)",
"title": "",
"type": "string"
},
"title": "Creators",
"type": "array",
"uniqueItems": true,
"widgetOptions": {
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users"
}
}
},
"description": {
"behavior": "plone.dublincore",
"description": "Used in item listings and search results.",
"factory": "Text",
"title": "Summary",
"type": "string",
"widget": "textarea"
},
"effective": {
"behavior": "plone.dublincore",
"description": "If this date is in the future, the content will not show up in listings and searches until this date.",
"factory": "Date/Time",
"title": "Publishing Date",
"type": "string",
"widget": "datetime"
},
"exclude_from_nav": {
"behavior": "plone.excludefromnavigation",
"default": false,
"description": "If selected, this item will not appear in the navigation tree",
"factory": "Yes/No",
"title": "Exclude from navigation",
"type": "boolean"
},
"expires": {
"behavior": "plone.dublincore",
"description": "When this date is reached, the content will no longer be visible in listings and searches.",
"factory": "Date/Time",
"title": "Expiration Date",
"type": "string",
"widget": "datetime"
},
"id": {
"behavior": "plone.shortname",
"description": "This name will be displayed in the URL.",
"factory": "Text line (String)",
"title": "Short name",
"type": "string"
},
"language": {
"behavior": "plone.dublincore",
"default": "en",
"description": "",
"factory": "Choice",
"title": "Language",
"type": "string",
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.SupportedContentLanguages"
}
},
"relatedItems": {
"additionalItems": true,
"behavior": "plone.relateditems",
"default": [],
"description": "",
"factory": "Relation List",
"items": {
"description": "",
"factory": "Relation Choice",
"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": {
"behavior": "plone.dublincore",
"description": "Copyright statement or other rights information on this item.",
"factory": "Text",
"title": "Rights",
"type": "string",
"widget": "textarea"
},
"subjects": {
"additionalItems": true,
"behavior": "plone.dublincore",
"description": "Tags are commonly used for ad-hoc organization of content.",
"factory": "Tuple",
"items": {
"description": "",
"factory": "Text line (String)",
"title": "",
"type": "string"
},
"title": "Tags",
"type": "array",
"uniqueItems": true,
"widgetOptions": {
"vocabulary": {
"@id": "http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Keywords"
}
}
},
"table_of_contents": {
"behavior": "plone.tableofcontents",
"description": "If selected, this will show a table of contents at the top of the page.",
"factory": "Yes/No",
"title": "Table of contents",
"type": "boolean"
},
"text": {
"behavior": "plone.richtext",
"description": "",
"factory": "Rich Text",
"title": "Text",
"type": "string",
"widget": "richtext"
},
"title": {
"behavior": "plone.dublincore",
"description": "",
"factory": "Text line (String)",
"title": "Title",
"type": "string"
},
"versioning_enabled": {
"behavior": "plone.versioning",
"default": true,
"description": "Enable/disable versioning for this document.",
"factory": "Yes/No",
"title": "Versioning enabled",
"type": "boolean"
}
},
"required": [
"title",
"author_email"
],
"title": "Page",
"type": "object"
}' | http PUT http://nohost/plone/@types/Document Accept:application/json Content-Type:application/json -a admin:secret
requests.put('http://nohost/plone/@types/Document', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'fieldsets': [{'fields': ['author_email', 'author_url', 'author_name'], 'id': 'author', 'title': 'Contact the author'}, {'fields': [], 'id': 'contact_info', 'title': 'Contact info'}], 'layouts': ['thumbnail_view', 'table_view'], 'properties': {'allow_discussion': {'behavior': 'plone.allowdiscussion', 'choices': [['True', 'Yes'], ['False', 'No']], 'description': 'Allow discussion for this content object.', 'enum': ['True', 'False'], 'enumNames': ['Yes', 'No'], 'factory': 'Choice', 'title': 'Allow discussion', 'type': 'string', 'vocabulary': {'@id': 'http://localhost:55001/plone/@sources/allow_discussion'}}, 'author_email': {'behavior': 'plone.dexterity.schema.generated.plone_5_1234567890_2_123456_0_Document', 'description': 'Email of the author', 'factory': 'Email', 'title': 'Author email', 'type': 'string', 'widget': 'email'}, 'author_name': {'description': 'Name of the author', 'factory': 'Text line (String)', 'title': 'Author name'}, 'author_url': {'description': 'Author webpage', 'factory': 'URL', 'maxLength': 30, 'minLength': 5, 'title': 'Author website'}, 'changeNote': {'behavior': 'plone.versioning', 'description': 'Enter a comment that describes the changes you made.', 'factory': 'Text line (String)', 'title': 'Change Note', 'type': 'string'}, 'contributors': {'additionalItems': True, 'behavior': 'plone.dublincore', 'description': 'The names of people that have contributed to this item. Each contributor should be on a separate line.', 'factory': 'Tuple', 'items': {'description': '', 'factory': 'Text line (String)', 'title': '', 'type': 'string'}, 'title': 'Contributors', 'type': 'array', 'uniqueItems': True, 'widgetOptions': {'vocabulary': {'@id': 'http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users'}}}, 'creators': {'additionalItems': True, 'behavior': 'plone.dublincore', '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.', 'factory': 'Tuple', 'items': {'description': '', 'factory': 'Text line (String)', 'title': '', 'type': 'string'}, 'title': 'Creators', 'type': 'array', 'uniqueItems': True, 'widgetOptions': {'vocabulary': {'@id': 'http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Users'}}}, 'description': {'behavior': 'plone.dublincore', 'description': 'Used in item listings and search results.', 'factory': 'Text', 'title': 'Summary', 'type': 'string', 'widget': 'textarea'}, 'effective': {'behavior': 'plone.dublincore', 'description': 'If this date is in the future, the content will not show up in listings and searches until this date.', 'factory': 'Date/Time', 'title': 'Publishing Date', 'type': 'string', 'widget': 'datetime'}, 'exclude_from_nav': {'behavior': 'plone.excludefromnavigation', 'default': False, 'description': 'If selected, this item will not appear in the navigation tree', 'factory': 'Yes/No', 'title': 'Exclude from navigation', 'type': 'boolean'}, 'expires': {'behavior': 'plone.dublincore', 'description': 'When this date is reached, the content will no longer be visible in listings and searches.', 'factory': 'Date/Time', 'title': 'Expiration Date', 'type': 'string', 'widget': 'datetime'}, 'id': {'behavior': 'plone.shortname', 'description': 'This name will be displayed in the URL.', 'factory': 'Text line (String)', 'title': 'Short name', 'type': 'string'}, 'language': {'behavior': 'plone.dublincore', 'default': 'en', 'description': '', 'factory': 'Choice', 'title': 'Language', 'type': 'string', 'vocabulary': {'@id': 'http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.SupportedContentLanguages'}}, 'relatedItems': {'additionalItems': True, 'behavior': 'plone.relateditems', 'default': [], 'description': '', 'factory': 'Relation List', 'items': {'description': '', 'factory': 'Relation Choice', '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': {'behavior': 'plone.dublincore', 'description': 'Copyright statement or other rights information on this item.', 'factory': 'Text', 'title': 'Rights', 'type': 'string', 'widget': 'textarea'}, 'subjects': {'additionalItems': True, 'behavior': 'plone.dublincore', 'description': 'Tags are commonly used for ad-hoc organization of content.', 'factory': 'Tuple', 'items': {'description': '', 'factory': 'Text line (String)', 'title': '', 'type': 'string'}, 'title': 'Tags', 'type': 'array', 'uniqueItems': True, 'widgetOptions': {'vocabulary': {'@id': 'http://localhost:55001/plone/@vocabularies/plone.app.vocabularies.Keywords'}}}, 'table_of_contents': {'behavior': 'plone.tableofcontents', 'description': 'If selected, this will show a table of contents at the top of the page.', 'factory': 'Yes/No', 'title': 'Table of contents', 'type': 'boolean'}, 'text': {'behavior': 'plone.richtext', 'description': '', 'factory': 'Rich Text', 'title': 'Text', 'type': 'string', 'widget': 'richtext'}, 'title': {'behavior': 'plone.dublincore', 'description': '', 'factory': 'Text line (String)', 'title': 'Title', 'type': 'string'}, 'versioning_enabled': {'behavior': 'plone.versioning', 'default': True, 'description': 'Enable/disable versioning for this document.', 'factory': 'Yes/No', 'title': 'Versioning enabled', 'type': 'boolean'}}, 'required': ['title', 'author_email'], 'title': 'Page', 'type': 'object'}, auth=('admin', 'secret'))
HTTP/1.1 204 No Content
Removing schema field/fieldset with DELETE
#
Delete an existing schema field by sending a DELETE
request to the URL of an existing schema field:
DELETE /plone/@types/Document/author_email HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
curl -i -X DELETE http://nohost/plone/@types/Document/author_email -H "Accept: application/json" --user admin:secret
http DELETE http://nohost/plone/@types/Document/author_email Accept:application/json -a admin:secret
requests.delete('http://nohost/plone/@types/Document/author_email', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
Response:
HTTP/1.1 204 No Content
Content-Type: application/json
Delete an existing schema fieldset by sending a DELETE
request to the URL of an existing schema fieldset:
DELETE /plone/@types/Document/contact_info HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
curl -i -X DELETE http://nohost/plone/@types/Document/contact_info -H "Accept: application/json" --user admin:secret
http DELETE http://nohost/plone/@types/Document/contact_info Accept:application/json -a admin:secret
requests.delete('http://nohost/plone/@types/Document/contact_info', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
Response:
HTTP/1.1 204 No Content