Remove a List of Assets from a Collection

delete

/documents/api/1.1/collections/{collectionId}/files

Removes the listed assets from the specified collection. By default, if an asset is not in the collection, an error is returned. The optional skipIfNotInCollection parameter can be used to get extended information about each asset ID listed.

.

Request

Supported Media Types
  • application/json
  • application/xml
Path Parameters
collectionId
Type: string
Required: true

Globally unique identifier (GUID) for the collection.

Body Parameter
The request body defines details on assets to be removed from the collection. Bold indicates a required value.
Root Schema : RemoveMultipleAssetsFromCollectionBody
The request body defines details on assets to be removed from the collection.

Response

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

The request was fulfilled.

Body

The items array is returned only if the optional parameter is used.

Root Schema : CollectionAddDeleteMultipleFilesResponse

The items array is returned only if the optional parameter is used.

Nested Schema : items
Type: array
List of file IDs that were acted on.
Nested Schema : ItemsAddedOrRemovedFromCollection
Example application/json

{
    "count":"3",
    "errorCode":"0",
    "id":"F072ECEAE8DFE10499D8C160T0000DEFAULT00000000",
    "idList":"DDEA5A0845C4628E6DAAE369T0000DEFAULT00000000,DD65472E2B67302C13474B5BT0000DEFAULT00000000,DDBCE14AECFED0D255373924T0000DEFAULT00000000",
    "type":"collection",
    "items":[
        {
            "type":"file",
            "id":"DDEA5A0845C4628E6DAAE369T0000DEFAULT00000000",
            "timeStamp":"{ts '2017-04-04 12:45:52.084'}"
        },
        {
            "type":"file",
            "id":"DD65472E2B67302C13474B5BT0000DEFAULT00000000",
            "timeStamp":"{ts '2017-04-04 12:45:52.097'}"
        },
        {
            "type":"file",
            "id":"DDBCE14AECFED0D255373924T0000DEFAULT00000000",
            "message":"!csDAMItemNotInCollection,fFileGUID:DDBCE14AECFED0D255373924T0000DEFAULT00000000,fFolderGUID:F072ECEAE8DFE10499D8C160T0000DEFAULT00000000",
            "timeStamp":"{ts '2017-04-04 12:45:52.110'}"
        }
    ]
}
400 Response

Request parameters are not formatted correctly.

403 Response

User does not have rights to the specified collection.

404 Response

Collection is in the trash or is not found.

Examples

The following example removes 3 assets from a collection.

DELETE .../collections/F5E88D06A5AEC588BDB96A2045B3E9DD649055F5640B/files

Request Header

None.

Request Body

{
	"idList": "D76EE391B7B098777666CBFF45B3E9DD649055F5640B,DBC670E5F422C0C4E2A0A03845B3E9DD649055F5640B,DD5294D6C01505D8AE9BB57445B3E9DD649055F5640B"
}

HTTP Status Code

HTTP_STATUS = 200

JSON Response

{
    "errorCode": "0",
    "id": "F5E88D06A5AEC588BDB96A2045B3E9DD649055F5640B",
    "idList": "D76EE391B7B098777666CBFF45B3E9DD649055F5640B,DBC670E5F422C0C4E2A0A03845B3E9DD649055F5640B,DD5294D6C01505D8AE9BB57445B3E9DD649055F5640B",
    "type": "collection"
}

Example 2

The following example removes 3 assets from a collection. By default, an error is returned if any of the assets are not in the collection.

DELETE .../collections/F5E88D06A5AEC588BDB96A2045B3E9DD649055F5640B/files

Request Header

None.

Request Body

{
	"idList": "D76EE391B7B098777666CBFF45B3E9DD649055F5640B,DBC670E5F422C0C4E2A0A03845B3E9DD649055F5640B,DD5294D6C01505D8AE9BB57445B3E9DD649055F5640B"
}

HTTP Status Code

HTTP_STATUS = 400

JSON Response

{
    "errorCode": "-96",
    "errorKey": "!csDAMItemNotInCollection,fFileGUID:D76EE391B7B098777666CBFF45B3E9DD649055F5640B,fFolderGUID:F5E88D06A5AEC588BDB96A2045B3E9DD649055F5640B",
    "errorMessage": "Item fFileGUID:D76EE391B7B098777666CBFF45B3E9DD649055F5640B is not a member of collection fFolderGUID:F5E88D06A5AEC588BDB96A2045B3E9DD649055F5640B.",
    "errorType": "collection",
    "id": "F5E88D06A5AEC588BDB96A2045B3E9DD649055F5640B",
    "idList": "D76EE391B7B098777666CBFF45B3E9DD649055F5640B,DBC670E5F422C0C4E2A0A03845B3E9DD649055F5640B,DD5294D6C01505D8AE9BB57445B3E9DD649055F5640B",
    "title": "Item fFileGUID:D76EE391B7B098777666CBFF45B3E9DD649055F5640B is not a member of collection fFolderGUID:F5E88D06A5AEC588BDB96A2045B3E9DD649055F5640B.",
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}

Example 3

The following example removes 3 assets from a collection, with 1 of the 3 assets not in the collection. With the skipIfNotInCollection=1 parameter, the response includes an items array. If an item in the array does not have a 'message' value, the item was removed from the collection. If the item has a 'message' value, it indicates why the item was not removed from the collection.

DELETE .../collections/F5E88D06A5AEC588BDB96A2045B3E9DD649055F5640B/files

Request Header

None.

Request Body

{
	"idList": "D76EE391B7B098777666CBFF45B3E9DD649055F5640B,DBC670E5F422C0C4E2A0A03845B3E9DD649055F5640B,DD5294D6C01505D8AE9BB57445B3E9DD649055F5640B"
	"skipIfNotInCollection": "1:
}

HTTP Status Code

HTTP_STATUS = 200

JSON Response

{
    "count": "3",
    "errorCode": "0",
    "id": "F5E88D06A5AEC588BDB96A2045B3E9DD649055F5640B",
    "idList": "D76EE391B7B098777666CBFF45B3E9DD649055F5640B,DBC670E5F422C0C4E2A0A03845B3E9DD649055F5640B,DD5294D6C01505D8AE9BB57445B3E9DD649055F5640B",
    "type": "collection",
    "items": [
        {
            "type": "file",
            "id": "D76EE391B7B098777666CBFF45B3E9DD649055F5640B",
            "timeStamp": "{ts '2017-05-16 22:36:28.127'}"
        },
        {
            "type": "file",
            "id": "DBC670E5F422C0C4E2A0A03845B3E9DD649055F5640B",
            "timeStamp": "{ts '2017-05-16 22:36:28.192'}"
        },
        {
            "type": "file",
            "id": "DD5294D6C01505D8AE9BB57445B3E9DD649055F5640B",
            "message": "!csDAMItemNotInCollection,fFileGUID:DD5294D6C01505D8AE9BB57445B3E9DD649055F5640B,fFolderGUID:F5E88D06A5AEC588BDB96A2045B3E9DD649055F5640B",
            "timeStamp": "{ts '2017-05-16 22:36:28.203'}"
        }
    ]
}

Example 4

In the following example, no items are removed from the collection because the collection is not owned by or shared with the user.

DELETE ../collections/F5D88A8F6F68BB240E3826DA45B3E9DD649052373471/files

Request Header

None.

Request Body

{
	"idList": "F5D88A8F6F68BB240E3826DA45B3E9DD649052373471"
	"skipIfNotInCollection": "1"
}

HTTP Status Code

HTTP_STATUS = 404

JSON Response

{
    "errorCode": "-16",
    "errorKey": "!csFldDoesNotExist,fFileGUID:F5D88A8F6F68BB240E3826DA45B3E9DD649052373471",
    "errorMessage": "'fFileGUID:F5D88A8F6F68BB240E3826DA45B3E9DD649052373471' does not exist.",
    "errorType": "collection",
    "id": "F5D88A8F6F68BB240E3826DA45B3E9DD649052373471",
    "idList": "F5D88A8F6F68BB240E3826DA45B3E9DD649052373471",
    "title": "'fFileGUID:F5D88A8F6F68BB240E3826DA45B3E9DD649052373471' does not exist.",
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}