API Reference > 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.
Before you make the API call, ensure that the data collection already exists in Data Marketplace, and the data asset already exist in either Data Marketplace or Data Governance and Catalog.

Endpoint and method

The following table describes the connection properties for the API:
Property
Description
Endpoint
/api/v1/integration/dataCollections/dataAssets
Method
PUT

Request

The following table describes the parameters that you enter in the body of the API payload:
Parameter
Description
Additional Information
dataCollectionId
Required. Enter the system generated unique identifier of the data collection to which you want to add a data asset or from which you want to remove a data asset.
For more information about how you can use an API to get the system generated unique identifier of a data collection, see Retrieve data collections.
To get the system generated unique identifier of a data collection from the Data Marketplace interface, open the data collection. The data collection page's URL contains the system generated unique identifier.
For example, in the URL https://{{CDMP_URL}}/datacollection/25158afc-3dfb-44ef-8f3e-cec1e171d0f1?dtn=&tab=summary, the system generated unique identifier is 25158afc-3dfb-44ef-8f3e-cec1e171d0f1.
assetId
Required. Enter the system generated unique identifier of the data asset that you want to add to a data collection or remove from a data collection.
For more information about how you can use an API to get the system generated unique identifier of a Data Marketplace data asset, see Retrieve data assets.
To get the system generated unique identifier of a data asset from the Data Marketplace interface, open the data asset. The data asset page's URL contains the system generated unique identifier.
For example, in the URL https://{{CDMP_URL}}/dataAsset/8c4c2089-6c7e-4696-a8f6-44f87639d65c?dtn=Table_Profiling_AK_1676302415587&tab=dataElements, the system generated unique identifier is 8c4c2089-6c7e-4696-a8f6-44f87639d65c.
For more information about how you can use an API to get the system generated unique identifier of a Data Governance and Catalog asset, see the Data Governance and Catalog help.
When you add a Data Governance and Catalog asset to a data collection, the Overview page of the asset in Data Governance and Catalog indicates that the asset is published to Data Marketplace. Additionally, you can view in Data Governance and Catalog the details of the data collection to which the asset was added.
operation
Required. Specify the action that you want to perform.
Enter one of the following values:
  • - To add a data asset to a data collection, enter ADD.
  • - To remove a data asset from a data collection, enter REMOVE.

Example request

The following example shows how you can use an API to add a data asset to a data collection:.

[
{
"dataCollectionId": "3c4c3349-6aac-4235-95e0-11b62a9dabcd",
"dataAssets": [
{
"assetId": "7f4227e2-93ad-4881-adb4-2be5842def09",
"operation": "ADD"
}
]
}
]

Response

When you pass the API payload in the REST client, the client displays a response for the request query based on the parameters you had mapped with values.
If the data asset is successfully added or removed, the following response is displayed:
204 OK code