HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Content Types

This topic describes the content type endpoints of the Optimizely Content Definitions API.

Content Types

The content type endpoints can be used 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 either 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' for validating each item in the list, 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 can be validated and also how many items a list or link collection property should have.
  • 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 new content type in the system. You can use name and id as an identifier, meaning they have to be unique in the system. You should that you specify an id since that makes renaming of Content Types easier. If a Content Type does not have an id and you rename it, a new 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 creates a new one if it does not already exist. Also known as upsert.

PUT/api/episerver/v3.0/contenttypes/{id}

List Content Types

List all content types in the system. If you only want to return a subset of all 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.


What’s Next