HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityLog In

Content Definitions API fundamentals

This topic explains the operations of the Content Definitions API.

Content Types

Available Content Type operations:

  • Create
  • Update
  • List
  • Get
  • Remove
  • Analyze

Create Content Type

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

post/api/episerver/v3.0/contenttypes

Creates a new content type in the system.

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.

Update (or create) Content Type

Also known as upsert. Updates the content type at the current location or create a new one if it does not already exist.

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

List all Content Types

If you only want to return a subset of all content types, you can use the top 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.

List all content types in the system.

get/api/episerver/v3.0/contenttypes

Get Content Type by identifier

Gets the content type at the current location.

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

Remove Content Type

Deletes the content type at this location.

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

See also Content Definitions API class library for the REST API service layer.


What’s Next
Did this page help you?