Create content type
1 min
POST
/_cms/v1/contenttypes
Header Parameters
- Preferstring[]Example
[ "return=representation" ]
Description
Body Parameters
- bodyContentTyperequiredDescription
- keystringDescriptionMin Length2Max Length255Pattern^[A-Za-z][_0-9A-Za-z]+$
- displayNamestringrequiredDescriptionMin Length1Max Length255
- descriptionstringDescriptionMax Length255
- baseTypestringDescription
- isContractbooleanDescription
- sortOrderinteger<int32>DescriptionFormatint32
- mayContainTypesstring[]Description
- mediaFileExtensionsstring[]Description
- compositionBehaviorsstring[]Description
- contractsstring[]Description
- propertiesmap<string, ContentTypeProperty>Description
- accessRightsSecurityIdentity[]Description
- namestringrequiredDescriptionMin Length1Max Length255
- typestring<user | role | application>DescriptionAlloweduserroleapplication
Responses
201
- ContentTypeDescription
- keystringDescriptionMin Length2Max Length255Pattern^[A-Za-z][_0-9A-Za-z]+$
- displayNamestringrequiredDescriptionMin Length1Max Length255
- descriptionstringDescriptionMax Length255
- baseTypestringDescription
- isContractbooleanDescription
- sourcestringDescription
- sortOrderinteger<int32>DescriptionFormatint32
- mayContainTypesstring[]Description
- mediaFileExtensionsstring[]Description
- compositionBehaviorsstring[]Description
- contractsstring[]Description
- createdstring<date-time>DescriptionFormatdate-time
- createdBystringDescription
- lastModifiedstring<date-time>DescriptionFormatdate-time
- lastModifiedBystringDescription
- propertiesmap<string, ContentTypeProperty>Description
- accessRightsSecurityIdentity[]Description
- namestringrequiredDescriptionMin Length1Max Length255
- typestring<user | role | application>DescriptionAlloweduserroleapplication
Response Headers
- ETagstringDescription
- Last-Modifiedstring<http-date>DescriptionFormathttp-date
- LocationstringDescription
- Preference-Applied
400
401
403
409
500
curl
curl --request POST \
--url /_cms/v1/contenttypes \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"displayName": "",
"accessRights": [
{
"name": ""
}
]
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"displayName": "",
"accessRights": [
{
"name": ""
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("/_cms/v1/contenttypes", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("/_cms/v1/contenttypes")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"displayName": "",
"accessRights": [
{
"name": ""
}
]
})
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "/_cms/v1/contenttypes"
payload = json.dumps({
"displayName": "",
"accessRights": [
{
"name": ""
}
]
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// Created
{
"key": "",
"displayName": "",
"description": "",
"baseType": "",
"isContract": false,
"source": "",
"sortOrder": "",
"mayContainTypes": [
""
],
"mediaFileExtensions": [
""
],
"compositionBehaviors": [
""
],
"contracts": [
""
],
"created": "",
"createdBy": "",
"lastModified": "",
"lastModifiedBy": "",
"properties": "",
"accessRights": [
{
"name": "",
"type": ""
}
]
}400
// Bad Request
401
// Unauthorized
403
// Forbidden
409
// Conflict
500
// Internal Server Error