Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 


#Product
#Analytics
#CognosAnalytics
#Analyticstools
#TechXchange Partner
#TechXchange Session
#TechXchange Presenter
#AI
 View Only
Expand all | Collapse all

REST or Content Manager API to create or modify dashboards?

  • 1.  REST or Content Manager API to create or modify dashboards?

    Posted 09/26/18 01:43 PM
    We want to generate new dashboards on-the-fly in our Cognos server, one for each of our customers. We want all dashboards to point to the same relational database, where each table has a column identifying the customer associated with the data, and use a data-tray filter in each dashboard to show only the data for the respective customer (we will only allow customers to access their respective dashboard with a read-only role, so that they cannot edit their dashboard) .

    We were able to use the Cognos SDK to locate the "Exploration" object for the original dashboard and then create a copy of it, then modify the "specification" attribute in the new Exploration object to filter on the correct customer identifier, but somehow the cloned dashboard keeps showing the same data as the original dashboard from where it was copied.

    Upon closer examination, we found out that if the dashboard owner (me) puts the new dashboard in edit mode, applies a random filter to any field in the data tray, then undoes the change, then the dashboard shows the correct data, matching the filter for the customer. Once the dashboard is saved, it works correctly from that point on.

    Using the Cognos SDK we could see that the only difference between the specification attribute before and after that 'fix' is a 'shapingId" attribute, which somehow seems to be a clue for Cognos about which filtering criteria to use.

    This may be an unusual scenario, but is any plan to support creation and modification of dashboards and/or data modules via Cognos SDK ?

    ------------------------------
    Denilson Nastacio
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 10/08/18 06:39 AM
    I found a workaround, which is no replacement for actual documentation of the exploration.specification attribute: Besides making modifications to
    datasources.sources[].shaping.moserJSON.querySubject[], also set all datasources.sources[].shaping.embeddedModuleUpToDate attributes to false.

    ------------------------------
    Denilson Nastacio
    ------------------------------



  • 3.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 05/29/19 09:57 AM
    Can you please help me on how you were able to query the Dashboard from SDK. I am not able to query the dashboard, only the functionality there were there in Cognos 10, I am only able to view those through SDK. For example, I am able to get the XML from SDK of the reports but if I want to see XML data for Dashboard, it returns me null

    ------------------------------
    Shubham Vashishtha
    ------------------------------



  • 4.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 05/29/19 09:57 AM
    Can you please explain to me how you were able to get the SDK to identify a Dashboard. I am able to query a report and get report data as XML but if I do the same with a Dashboard or Data Module it does not work. It does even recognize there is a Dashboard present in the folder structure. Can you please help me on what changes are required in SDK to do that

    ------------------------------
    Shubham Vashishtha
    ------------------------------



  • 5.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 05/30/19 09:03 AM
    If you are using the Cognos 11 SDK, there is a new "Exploration" class to represent dashboards, and the field is called "specification"
    import com.cognos.developer.schemas.bibus._3.BaseClass;
    import com.cognos.developer.schemas.bibus._3.Exploration;
    ...
    
    CRNConnect connection = (see SDK examples)
    BaseClass[] queryResult = connection.getCMService().query(
                        new SearchPathMultipleObject("/content/folder[@name='somefolder']/exploration[@name='dashboardname']"), objProps, new Sort[] {},
                        new QueryOptions());
    
    Exploration dashboard = queryResult[0];
    String specification = dashboard.getSpecification().getValue();


    ------------------------------
    Denilson Nastacio
    ------------------------------



  • 6.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 05/30/19 10:10 AM
    Thanks for the quick reply. Could you help me on how you get hold of this information? Have you gone through the code or is there some document by IBM available. Please share me any link if there is. Thanks again!

    ------------------------------
    Shubham Vashishtha
    ------------------------------



  • 7.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 05/30/19 10:20 AM
    I installed the SDK and studied the code. There is virtually nothing on Cognos documentation about dealing with Dashboard objects, which is a problem for projects attempting to embed the Cognos UI or automate deployments.

    One thing that helped a lot in the SDK is the content manager explorer, so I could always create and modify objects in the Cognos UI, then go back to the explorer and figure out the classes and attribute of the objects to be created via API.

    ------------------------------
    Denilson Nastacio
    ------------------------------



  • 8.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 05/30/19 10:30 AM
    Yeah I was also not able to find anything in documents. Thanks for the help.


    ------Original Message------

    I installed the SDK and studied the code. There is virtually nothing on Cognos documentation about dealing with Dashboard objects, which is a problem for projects attempting to embed the Cognos UI or automate deployments.

    One thing that helped a lot in the SDK is the content manager explorer, so I could always create and modify objects in the Cognos UI, then go back to the explorer and figure out the classes and attribute of the objects to be created via API.

    ------------------------------
    Denilson Nastacio
    ------------------------------

    #CognosAnalyticswithWatson


  • 9.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 05/31/19 02:02 PM
    What version of SDK are you using 11.0.x or 11.1.x?

    ------------------------------
    Oleg Nevedrov
    ------------------------------



  • 10.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 05/31/19 02:37 PM
    SDK version is 11.0.11


    ------Original Message------

    What version of SDK are you using 11.0.x or 11.1.x?

    ------------------------------
    Oleg Nevedrov
    ------------------------------

    #CognosAnalyticswithWatson


  • 11.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 05/31/19 03:14 PM
    For whatever it is worth, when you download the 11.1.x SDK, it still has the JAR files from 11.0.9, which I think are the same as the ones as in 11.0.8.

    ------------------------------
    Denilson Nastacio
    ------------------------------



  • 12.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 07/11/19 10:00 AM

    thank you
    this is exactly what i need
    You can  convert the result string again with JSON.parse



    ------------------------------
    Steve Lukather
    ------------------------------



  • 13.  RE: REST or Content Manager API to create or modify dashboards?

    Posted 05/30/19 09:06 AM

    By the way, I eventually found out the answer to my original question, making this change to the dashboard specification:

    String result = specification.replaceAll("\"embeddedModuleUpToDate\":(\\s)*true",
    "\"embeddedModuleUpToDate\":false");

    I presume this tells Cognos that the cached data for the dashboard is no longer valid and forces it to create a new internal data module for it.



    ------------------------------
    Denilson Nastacio
    ------------------------------