API Reference > Part II: Authenticate using JWT > Manage data collections > Add or remove data assets from data collections
  

Add or remove data assets from data collections

Use a REST API to add a data asset to a data collection or to remove a data asset from a data collection.

Endpoint and method

The following table describes the connection properties for the API:
Property
Description
Endpoint
/api/v2/data-collections/<dataCollectionId>/data-assets
<dataCollectionId>: Required. Enter the system-generated unique identifier of the data collection to which you want to add the data assets.
For more information about how you can use an API to get the system-generated unique identifier of a data collection, see Retrieve all data collections.
To get the system-generated unique identifier of a data collection from the Data Marketplace user interface, open the data collection. The data collection page's URL contains the unique identifier.
For example, in the URL https://{{CDMP_URL}}/datacollection/25158afc-3dfb-44ef-8f3e-cec1e171d0f1?dtn=&tab=summary, the unique identifier is 25158afc-3dfb-44ef-8f3e-cec1e171d0f1.
Method
PATCH
Note: You can add a maximum of 40 data assets to a data collection per API call.
For more information about how you can call an API, see Authenticate using JWT.

Request

The following table describes the parameters that you enter in the body of the API payload:
Parameter
Description
Additional Information
operation
Required. Specify whether you want to add or remove the data asset.
Enter one of the following values:
  • - To add a data asset to the data collection, enter add.
  • - To remove a data asset from the data collection, enter remove.
-
dataAssetIds
Required. Enter the system-generated unique identifier of the data asset that you want to add to the data collection.
For more information about how you can use an API to get the system-generated unique identifier of a data asset, see Retrieve data assets.
To get the system-generated unique identifier of a data asset from the Data Marketplace user interface, open the data asset. The data asset page's URL contains the unique identifier.
For example, in the URL https://{{CDMP_URL}}/dataAsset/8c4c2089-6c7e-4696-a8f6-44f87639d65c?dtn=Table_Profiling_AK_1676302415587&tab=dataElements, the unique identifier is 8c4c2089-6c7e-4696-a8f6-44f87639d65c.

Example request

The following example shows how you can use an API to add data assets to a data collection:
{
"operation": "add",
"dataAssetIds": [
"b93c4539-a93e-440d-a4b4-95d69b8911e6",
"2593524d-82f7-4dfd-bc6b-17088c046f9d"
]
}

Response

When you invoke the API using a REST client, the client displays a response for the parameter values that you have entered.
If you see the following response code, it means that the data asset is successfully added to the data collection:
204 OK code