Cognos Analytics

 View Only

 Possible field values when using "get object by id" (REST API Cognos 11.2)

  • IBMChampion
Richard Meyer-Eppler's profile image
Richard Meyer-Eppler posted Tue November 26, 2024 04:14 AM

What are all possible values of the "fields" parameter when using the "get object by id" request (see https://developer.ibm.com/apis/catalog/cognosanalytics--cognos-analytics-rest-api/api/API--cognosanalytics--cognos-analytics-12-0-3#get_object)?

Through trial and error, I have found out that the following values seem to work:

  • creationTime,
  • description,
  • permissions,
  • hidden,
  • shown,
  • position,
  • disabled,
  • tenantID,
  • policies.

In particular, I am looking for a way to return the package or data module and the search path for any given content id. I have tried entering likely parameter values such as "searchPath", "searchPathForURL", or "package", without success.

I am using the REST API with Cognos 11.2.4 FP4.

Paul Mendelson's profile image
Paul Mendelson IBM Champion

You can use fields=* to get a full list of all of the attributes for that object.

In this example /api/v1/content/i8488CC9B2E5240FCAE491A5A9A605588?fields=* it's pulling a report. The return is this:

{
  "modificationTime": "2024-11-25T21:52:58.427Z",
  "defaultName": "Report 12",
  "id": "i8488CC9B2E5240FCAE491A5A9A605588",
  "type": "report",
  "version": 2,
  "owner": [
    {
      "userName": "CognosAdmin",
      "defaultName": "CognosAdmin"
    }
  ],
  "fields": {
    "routingServerGroup": null,
    "references": null,
    "triggerName": null,
    "usage": "object",
    "serverGroup": null,
    "defaultPortalAction": "viewOutput",
    "packageBase": "/",
    "shown": true,
    "permissions": [
      "execute",
      "read",
      "setPolicy",
      "traverse",
      "write"
    ],
    "metadataModel": null,
    "displaySequence": 0,
    "options": null,
    "allowNotification": true,
    "iconURI": null,
    "externalReferences": null,
    "executionPageDefinition": null,
    "defaultScreenTip": null,
    "triggerDescription": null,
    "module": [
      {
        "searchPath": "/content/folder[@name='Samples']/folder[@name='By feature']/folder[@name='Core']/folder[@name='Data']/module[@name='Great outdoors data module']",
        "_meta": {
          "links": {
            "path": {
              "mimeType": "application/vnd.ibm.bi.module+json",
              "url": "/bi/v1/path?path=.public_folders%2FSamples%2FBy%2Bfeature%2FCore%2FData%2FGreat%2Boutdoors%2Bdata%2Bmodule"
            },
            "smarts_modules": {
              "mimeType": "application/json",
              "url": "/bi/v1/objects/iE0EF826B057344759CFA4318620A6787/smarts_modules"
            },
            "self": {
              "mimeType": "application/vnd.ibm.bi.module+json",
              "url": "/bi/v1/objects/iE0EF826B057344759CFA4318620A6787"
            }
          }
        },
        "id": "iE0EF826B057344759CFA4318620A6787",
        "type": "module"
      }
    ],
    "executionPageOrientation": null,
    "allowSubscription": false,
    "executionFormat": null,
    "extensions": {},
    "paths": null,
    "name": {
      "de-de": "Report 12"
    },
    "runWithOwnerCapabilities": null,
    "position": 0,
    "notificationListIsEmpty": true,
    "parameters": null,
    "queryMode": null,
    "creationTime": "2024-11-25T14:15:29.030Z",
    "hidden": false,
    "executionPrompt": true,
    "executionLocale": null,
    "description": null,
    "retentions": [
      {
        "prop": "creationTime",
        "objectClass": "history",
        "maxObjects": 5
      },
      {
        "prop": "creationTime",
        "objectClass": "reportVersion",
        "maxObjects": 1
      }
    ],
    "defaultTriggerDescription": null,
    "viewed": false,
    "contactEMail": null,
    "tenantID": "",
    "disabled": false,
    "defaultOutputFormat": [
      "PDF"
    ],
    "runAsOwner": null,
    "specification": "<report>Snipped for brevity</report>",
    "metadataModelPackage": null,
    "canBurst": false,
    "routingServerGroupEdition": "",
    "runInAdvancedViewer": true,
    "screenTip": null,
    "defaultDescription": null
  },
  "links": [
    {
      "rel": "self",
      "type": "application/json",
      "href": "/api/v1/content/i8488CC9B2E5240FCAE491A5A9A605588"
    },
    {
      "rel": "items",
      "type": "application/json",
      "href": "/api/v1/content/i8488CC9B2E5240FCAE491A5A9A605588/items"
    }
  ],
  "routingServerGroup": null,
  "references": null,
  "triggerName": null,
  "usage": "object",
  "serverGroup": null,
  "defaultPortalAction": "viewOutput",
  "packageBase": "/",
  "shown": true,
  "permissions": [
    "execute",
    "read",
    "setPolicy",
    "traverse",
    "write"
  ],
  "metadataModel": null,
  "displaySequence": 0,
  "options": null,
  "allowNotification": true,
  "iconURI": null,
  "externalReferences": null,
  "executionPageDefinition": null,
  "defaultScreenTip": null,
  "triggerDescription": null,
  "module": [
    {
      "searchPath": "/content/folder[@name='Samples']/folder[@name='By feature']/folder[@name='Core']/folder[@name='Data']/module[@name='Great outdoors data module']",
      "_meta": {
        "links": {
          "path": {
            "mimeType": "application/vnd.ibm.bi.module+json",
            "url": "/bi/v1/path?path=.public_folders%2FSamples%2FBy%2Bfeature%2FCore%2FData%2FGreat%2Boutdoors%2Bdata%2Bmodule"
          },
          "smarts_modules": {
            "mimeType": "application/json",
            "url": "/bi/v1/objects/iE0EF826B057344759CFA4318620A6787/smarts_modules"
          },
          "self": {
            "mimeType": "application/vnd.ibm.bi.module+json",
            "url": "/bi/v1/objects/iE0EF826B057344759CFA4318620A6787"
          }
        }
      },
      "id": "iE0EF826B057344759CFA4318620A6787",
      "type": "module"
    }
  ],
  "executionPageOrientation": null,
  "allowSubscription": false,
  "executionFormat": null,
  "extensions": {},
  "paths": null,
  "name": {
    "de-de": "Report 12"
  },
  "runWithOwnerCapabilities": null,
  "position": 0,
  "notificationListIsEmpty": true,
  "parameters": null,
  "queryMode": null,
  "creationTime": "2024-11-25T14:15:29.030Z",
  "hidden": false,
  "executionPrompt": true,
  "executionLocale": null,
  "description": null,
  "retentions": [
    {
      "prop": "creationTime",
      "objectClass": "history",
      "maxObjects": 5
    },
    {
      "prop": "creationTime",
      "objectClass": "reportVersion",
      "maxObjects": 1
    }
  ],
  "defaultTriggerDescription": null,
  "viewed": false,
  "contactEMail": null,
  "tenantID": "",
  "disabled": false,
  "defaultOutputFormat": [
    "PDF"
  ],
  "runAsOwner": null,
  "specification": "<report>Snipped for brevity</report>",
  "metadataModelPackage": null,
  "canBurst": false,
  "routingServerGroupEdition": "",
  "runInAdvancedViewer": true,
  "screenTip": null,
  "defaultDescription": null
}

There's another API that's not published (but I keep pushing IBM to publish it) that does include the searchpath and ancestors.

/bi/v1/expressbus/content-manager?searchPath=storeID("i8488CC9B2E5240FCAE491A5A9A605588")&properties=*&options={refProps:[{refPropName:parent,properties:[defaultName,searchPath,type,id]}]}

This API is run through the gateway, as opposed to calling the dispatcher (or using a redirect set up in your webserver), which I find makes it easier to use. 

The searchpath can be an xpath expression returning multiple objects, so you'll get an array of objects 
searchPath=//report <-returns every report your user has access to 
searchPath=//folder[contains(@name,'Sales')]/report <-returns every report directly inside of any folder containing the name "Sales" 

The options lets you define fields to use inside properties
options={refProps:[{refPropName:parent,properties:[defaultName,searchPath,type,id]}]}`) <- this will populate the parent field with defaultName, searchPath, type, and id. 

example:

[{
    "parent": [
        {
            "searchPath": "/content/folder[@name='Demo']/folder[@name='Merge PDFs']/folder[@name='50 Report Test Case']",
            "_meta": {
                "links": {
                    "path": {
                        "mimeType": "application/vnd.ibm.bi.folder+json",
                        "url": "/path?path=.public_folders%2FDemo%2FMerge%2BPDFs%2F50%2BReport%2BTest%2BCase"
                    },
                    "self": {
                        "mimeType": "application/vnd.ibm.bi.folder+json",
                        "url": "/objects/i9F2284D8013C4D17B8B3E77DF5DF6EFC"
                    },
                    "items": {
                        "mimeType": "application/json",
                        "url": "/objects/i9F2284D8013C4D17B8B3E77DF5DF6EFC/items"
                    }
                }
            },
            "id": "i9F2284D8013C4D17B8B3E77DF5DF6EFC",
            "type": "folder",
            "defaultName": "50 Report Test Case"
        }
    ],
    "routingServerGroup": null,
    "references": null,
    "triggerName": null,
    "hasChildren": true,
    "usage": "object",
    "serverGroup": null,
    "_meta": {
        "links": {
            "path": {
                "mimeType": "application/vnd.ibm.bi.report+json",
                "url": "/path?path=.public_folders%2FDemo%2FMerge%2BPDFs%2F50%2BReport%2BTest%2BCase%2FReport%2B12"
            },
            "versions": {
                "mimeType": "application/json",
                "url": "/objects/i8488CC9B2E5240FCAE491A5A9A605588/versions"
            },
            "self": {
                "mimeType": "application/vnd.ibm.bi.report+json",
                "url": "/objects/i8488CC9B2E5240FCAE491A5A9A605588"
            },
            "histories": {
                "mimeType": "application/json",
                "url": "/objects/i8488CC9B2E5240FCAE491A5A9A605588/histories"
            }
        }
    },
    "type": "report",
    "defaultPortalAction": "viewOutput",
    "packageBase": "/",
    "shown": true,
    "modificationTime": "2024-11-25T21:52:58.427Z",
    "permissions": [
        "execute",
        "read",
        "setPolicy",
        "traverse",
        "write"
    ],
    "metadataModel": null,
    "displaySequence": 0,
    "contact": null,
    "options": null,
    "allowNotification": true,
    "id": "i8488CC9B2E5240FCAE491A5A9A605588",
    "ancestors": [
        {
            "_meta": {
                "links": {
                    "self": {
                        "mimeType": "application/vnd.ibm.bi.content+json",
                        "url": "/objects/iFC2FE60C492A4C6F8C3057E7B52E39EB"
                    },
                    "items": {
                        "mimeType": "application/json",
                        "url": "/objects/iFC2FE60C492A4C6F8C3057E7B52E39EB/items"
                    }
                }
            },
            "id": "iFC2FE60C492A4C6F8C3057E7B52E39EB",
            "type": "content",
            "defaultName": "Team Content"
        },
        {
            "_meta": {
                "links": {
                    "self": {
                        "mimeType": "application/vnd.ibm.bi.folder+json",
                        "url": "/objects/i74DA3662044F4F608312131349914D43"
                    },
                    "items": {
                        "mimeType": "application/json",
                        "url": "/objects/i74DA3662044F4F608312131349914D43/items"
                    }
                }
            },
            "id": "i74DA3662044F4F608312131349914D43",
            "type": "folder",
            "defaultName": "Demo"
        },
        {
            "_meta": {
                "links": {
                    "self": {
                        "mimeType": "application/vnd.ibm.bi.folder+json",
                        "url": "/objects/i71D4D6D6F2FC490D9642A5C15E83E95E"
                    },
                    "items": {
                        "mimeType": "application/json",
                        "url": "/objects/i71D4D6D6F2FC490D9642A5C15E83E95E/items"
                    }
                }
            },
            "id": "i71D4D6D6F2FC490D9642A5C15E83E95E",
            "type": "folder",
            "defaultName": "Merge PDFs"
        },
        {
            "_meta": {
                "links": {
                    "self": {
                        "mimeType": "application/vnd.ibm.bi.folder+json",
                        "url": "/objects/i9F2284D8013C4D17B8B3E77DF5DF6EFC"
                    },
                    "items": {
                        "mimeType": "application/json",
                        "url": "/objects/i9F2284D8013C4D17B8B3E77DF5DF6EFC/items"
                    }
                }
            },
            "id": "i9F2284D8013C4D17B8B3E77DF5DF6EFC",
            "type": "folder",
            "defaultName": "50 Report Test Case"
        }
    ],
    "defaultName": "Report 12",
    "iconURI": null,
    "externalReferences": null,
    "executionPageDefinition": null,
    "defaultScreenTip": null,
    "triggerDescription": null,
    "module": [
        {
            "searchPath": "/content/folder[@name='Samples']/folder[@name='By feature']/folder[@name='Core']/folder[@name='Data']/module[@name='Great outdoors data module']",
            "_meta": {
                "links": {
                    "path": {
                        "mimeType": "application/vnd.ibm.bi.module+json",
                        "url": "/path?path=.public_folders%2FSamples%2FBy%2Bfeature%2FCore%2FData%2FGreat%2Boutdoors%2Bdata%2Bmodule"
                    },
                    "smarts_modules": {
                        "mimeType": "application/json",
                        "url": "/objects/iE0EF826B057344759CFA4318620A6787/smarts_modules"
                    },
                    "self": {
                        "mimeType": "application/vnd.ibm.bi.module+json",
                        "url": "/objects/iE0EF826B057344759CFA4318620A6787"
                    }
                }
            },
            "id": "iE0EF826B057344759CFA4318620A6787",
            "type": "module"
        }
    ],
    "executionPageOrientation": null,
    "version": 2,
    "allowSubscription": false,
    "executionFormat": null,
    "extensions": {},
    "paths": null,
    "name": {
        "de-de": "Report 12"
    },
    "runWithOwnerCapabilities": null,
    "position": 0,
    "notificationListIsEmpty": true,
    "parameters": null,
    "queryMode": null,
    "creationTime": "2024-11-25T14:15:29.030Z",
    "hidden": false,
    "executionPrompt": true,
    "executionLocale": null,
    "searchPath": "/content/folder[@name='Demo']/folder[@name='Merge PDFs']/folder[@name='50 Report Test Case']/report[@name='Report 12']",
    "description": null,
    "retentions": [
        {
            "prop": "creationTime",
            "objectClass": "history",
            "maxObjects": 5
        },
        {
            "prop": "creationTime",
            "objectClass": "reportVersion",
            "maxObjects": 1
        }
    ],
    "defaultTriggerDescription": null,
    "viewed": false,
    "contactEMail": null,
    "tenantID": "",
    "disabled": false,
    "owner": [
        {
            "searchPath": "CAMID(\"CognosEx:u:uid=cognosadmin\")",
            "_meta": {
                "links": {
                    "self": {
                        "mimeType": "application/vnd.ibm.bi.account+json",
                        "url": "/objects/xQ29nbm9zRXg6dTp1aWQ9Y29nbm9zYWRtaW4_"
                    },
                    "items": {
                        "mimeType": "application/json",
                        "url": "/objects/xQ29nbm9zRXg6dTp1aWQ9Y29nbm9zYWRtaW4_/items"
                    }
                }
            },
            "id": "xQ29nbm9zRXg6dTp1aWQ9Y29nbm9zYWRtaW4_",
            "type": "account"
        }
    ],
    "defaultOutputFormat": [
        "PDF"
    ],
    "runAsOwner": null,
    "specification": "<report>snipped</report>",
    "metadataModelPackage": null,
    "canBurst": false,
    "routingServerGroupEdition": "",
    "runInAdvancedViewer": true,
    "searchPathForURL": "URLID(\"NDUwNzoxNzMyNTM2OTI5MDMwOjUwMzU=\")",
    "screenTip": null,
    "defaultDescription": null
}]

Richard Meyer-Eppler's profile image
Richard Meyer-Eppler

Thanks, Paul, that's really helpful! I am excited to see that the report specification can also be requested.

The use of * as the parameter should really be documented by IBM, or is that a standard REST convention that I am not aware of? Either way, works beautifully.

I will stay away from the undocumented expressbus API for now, but it is good to know that it exists.

In the long run, I am looking for a way to search for report dependencies as the Framework Manager is capable of doing. For instance, I would like to list all measures used for each existing report. From my current understanding, this information cannot be derived from the content store directly, but must be pieced together from the report XML. If you know of any better way, please let me know, I'd be delighted!

Paul Mendelson's profile image
Paul Mendelson IBM Champion

Listing all of the measures used in a report is actually something I've done in a few different ways. 

This was something I wrote for a datamodule tool. As far as I can see, the only way to do this is to use the expressbus/content-manager API. First I narrow down the search based on the module.

The flow is

  1. I get a list of all objects referencing a module:
    /v1/expressbus/content-manager?searchPath=//*[@module]&properties=module,storeID&options={refProps:[{refPropName:module,properties:[id]}]}
  2. filter the list on the module ID I'm using. 
  3. loop through each object to get the specifications. 
  4. Parse the underlying specifications (XML, JSON)

The hard part here is dashboards and reports reference the same data items with slightly different methods. Advanced data items in reports may also have a different data item format.

I'm also working on another tool that pulls everything out of Cognos, and finds the lineage to the underlying package/data module. I'm doing that with python, but it's a little more complicated as it means tracking references across multiple levels of data modules, packages, namespaces, and so on. Again, the only way I've found to do that is to use the expressbus/content-manager API.

All that being said, there are some SDK methods that I haven't touched that might also allow you to pull multiple objects by searchpath.