Search code examples
catalogdata-science-experience

How to list all assets in a catalog in watson data science experience?


I have created a Watson data science experience (DSX) account, created a catalog into it and added data assets to it. I am trying to use the REST APIs as documented at: https://developer.ibm.com/api/view/id-1084:title-Watson_Data_Platform_Core_Services#id36962 ... to retrieve the assets using curl.

curl -H "Authorization: Bearer <---stripped the auth token --->" -X GET 'https://api.dataplatform.ibm.com/v2/assets?catalog_id=bd2b56c3-091f-4ff5-beab-b3a1da85488d'

I get the following response:
{
    "errors": [
        {
            "code": "invalid_parameter",
            "message": "COMSV3006E: Missing or Invalid 'asset' id",
            "target": {
                "name": "asset",
                "type": "parameter"
            }
        }
    ],
    "trace": "e7b07khusvkj7s0ymgrggm6si"
}

How do I specify the asset id to retrieve the same? Also, I am looking to upload assets, assign metadata/tags to existing assets using REST APIs. Is there any documentation/tutorial available, which can help explain me that?


Solution

  • One option is the search api, although it is listed as deprecated:

    curl -X POST -d '{"query":"asset.asset_state:available"}' -H "Content-Type: application/json" https://api.dataplatform.ibm.com/v2/catalogs/<catalog_guid>/types/<type>/search -H "Authorization: Bearer ...."
    

    https://developer.ibm.com/api/view/id-1084:title-Watson_Data_Platform_Core_Services#id37001

    For <type>, you probably want data_asset, but you can also look up all existing types:

    curl -X GET https://api.dataplatform.ibm.com/v2/catalogs/<catalog_guid>/types -H "Authorization: Bearer ...."
    

    https://developer.ibm.com/api/view/id-1084:title-Watson_Data_Platform_Core_Services#id36916