Remove a List of Assets from a Collection
/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
- application/json
- application/xml
- collectionId
-
Type:
string
Required:true
Globally unique identifier (GUID) for the collection.
- idList
-
Type:
string
(Required) Comma-separated list of globally unique identifiers (GUIDs) of assets to be added to the collection. - skipIfNotInCollection
-
Type:
boolean
When true, the response includes an items array that includes details on each asset added to the collection.
Response
- application/json
- application/xml
The request was fulfilled.
The items array is returned only if the optional parameter is used.
The items array is returned only if the optional parameter is used.
- count
-
Type:
string
The number of assets acted on by the request. - errorCode
-
Type:
string
An error code of zero (0) indicates no errors. - id
-
Type:
string
The collection ID. - idList
-
Type:
string
A comma-separated list of file IDs that were acted on. - items
-
Type:
array
itemsAdditional Properties Allowed:List of file IDs that were acted on. - type
-
Type:
string
Item typecollection
.
array
-
Type:
object
ItemsAddedOrRemovedFromCollectionAdditional Properties Allowed:
- id
-
Type:
string
The collection ID. - message
-
Type:
string
A message indicating the action was not successful. - timeStamp
-
Type:
string
Date the asset was processed. - type
-
Type:
string
Item typefile
.
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'}"
}
]
}
Request parameters are not formatted correctly.
User does not have rights to the specified collection.
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" }