Create a Collection

post

/documents/api/1.1/collections

Create a collection of assets.

Request

Supported Media Types
  • application/json
  • application/xml
Body Parameter

This parameter must include the name parameter, which is the name of the collection. This parameter can optionally include the description parameter, which is a description of the collection.

Root Schema : CollectionsCreateBody
The request body defines details of the collection to be created.
Example application/json

{
    "name":"myCollection",
    "description":"Optional description"
}

Response

Supported Media Types
  • application/json
  • application/xml
201 Response

The request was fulfilled.

Body

The response includes details on the created collection.

Root Schema : CollectionCreateResponse

The response includes details on the created collection.

Nested Schema : User
User information
Example application/json

{
    "childItemsCount":"0",
    "createdBy":{
        "id":"U0EAA20910FAF3052ACB79E4T00000000001",
        "displayName":"User AA",
        "loginName":"UserAA",
        "type":"user"
    },
    "createdTime":"2017-03-28T20:09:21Z",
    "description":"Optional description",
    "errorCode":"0",
    "id":"F79BD107FC398ED6FB482274T0000DEFAULT00000000",
    "modifiedBy":{
        "id":"U0EAA20910FAF3052ACB79E4T00000000001",
        "displayName":"User AA",
        "loginName":"UserAA",
        "type":"user"
    },
    "modifiedTime":"2017-03-28T20:09:21Z",
    "name":"myCollection",
    "ownedBy":{
        "id":"U0EAA20910FAF3052ACB79E4T00000000001",
        "displayName":"User AA",
        "loginName":"UserAA",
        "type":"user"
    },
    "type":"collection"
}
400 Response

Request parameters are not formatted correctly.

Examples

The following example creates a new collection.

POST .../collections

Request Header

None.

Request Body

{
	"name" : "Collection1",
	"description" : "Collection Description"
}

HTTP Status Code

HTTP_STATUS = 201

JSON Response

{
    "childItemsCount": "0",
    "createdBy": {
        "displayName": "cecsuser4",
        "id": "U5C4D5FCE14F2B44946FA74745B3E9DD6490",
        "loginName": "tenant1.cecsuser4",
        "type": "user"
    },
    "createdTime": "2017-05-16T19:55:57Z",
    "description": "Collection Description",
    "errorCode": "0",
    "id": "FEFFA68839EB0B144EDCD29545B3E9DD649055F5640B",
        "modifiedBy": {
        "displayName": "cecsuser4",
        "id": "U5C4D5FCE14F2B44946FA74745B3E9DD6490",
        "loginName": "tenant1.cecsuser4",
        "type": "user"
    },
    "modifiedTime": "2017-05-16T19:55:57Z",
    "name": "Collection1",
    "ownedBy": {
        "displayName": "cecsuser4",
        "id": "U5C4D5FCE14F2B44946FA74745B3E9DD6490",
        "loginName": "tenant1.cecsuser4",
        "type": "user"
    },
    "type": "collection"
}

Example 2

The following example doesn’t create a collection because no request body was submitted with the request.

POST .../collections

Request Header

None.

Request Body

None.

HTTP Status Code

HTTP_STATUS = 400

JSON Response

{
    "errorCode": "-97",
    "errorKey": "!csRequiredFieldMissing2,collectionName",
    "errorMessage": "The required field 'collectionName' is missing.",
    "errorType": "collection",
    "title": "The required field 'collectionName' is missing.",
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}