Content types
Describes the content type endpoints of the Optimizely Content Definitions API.
Content types
You can use the content type endpoints to manage content types in an Optimizely Content Management System (CMS) application.
Example content type
{
"id": "BAE92BED-C02D-477D-AA3E-5E3CFEC630A5",
"name": "News page",
"baseType": "Page",
"version": "2.1.241",
"supportedMediaExtensions": null,
"editSettings": {},
"properties": [
{
"name": "Heading",
"dataType": "PropertyString",
"branchSpecific": true,
"editSettings": {
"displayName": "Heading",
"groupName": "Information",
"sortOrder": 1,
"hint": "specialString"
},
"validation": [
{
"name": "length",
"minimum": 3,
"severity": "error",
"errorMessage": "The heading must be at least 3 characters long"
}
]
}
]
}
Version
See Semantic versioning.
Base type
Supported types are:
- page
- block
- folder
- media
- image
- video.
Properties
Data type
See Property Data Types for available types and how to use them.
Edit settings
groupName
– Controls in which tab the property should be displayed in the editing user interface. The name is the identifier of the property group. See Property Groups.hint
– Used to select editor, renderer, or both by defining a hint string. You can use this hint to select an Editor Definitions. Also see Property Data Types.
Validation
Validation works on the most common properties and list properties. For lists, you need to prefix the name with 'item' to validate each item, for example, itemRegularExpression. Possible names:
regularExpression
– Has a pattern setting. Regular expression can only validate string properties.length
– Has a minimum and maximum setting. The length of string properties and how many items a list or link collection property should have can be validated.range
– Has a minimum and maximum setting. Range validation can be applied to numerical and date properties.
Important
Changes to validation settings are not covered by versioning.
Note
Validation defined here is not the same as data annotation; that is, decorating properties in C# classes with validation attributes. These work in conjunction with each other, but you should choose one over the other.
Create content type
Creates a content type in the system. You can use name and ID as an identifier, meaning they must be unique in the system. You should specify an ID because that makes renaming content types easier. If a content type does not have an ID and you rename it, a content type is created, and you might have to convert content that used the old name.
POST /api/episerver/v3.0/contenttypes
Update (or create) content type
Updates the content type with the provided identifier and creates one if it does not already exist. They are also known as upsert.
PUT /api/episerver/v3.0/contenttypes/{id}
List content types
List content types in the system. If you only want to return a subset of content types, you can use the top
query parameter. In the response, you get back a continuation token in the header x-epi-continuation
. Use this token in subsequent requests to get the next subset.
GET /api/episerver/v3.0/contenttypes
Get content type
Gets the content type with the provided identifier.
GET /api/episerver/v3.0/contenttypes/{id}
Remove content type
Deletes the content type with the provided identifier.
DELETE /api/episerver/v3.0/contenttypes/{id}
See also Content Definitions API class library for the REST API service layer.
Updated 8 months ago