Forum Discussion

vladimir's avatar
vladimir
Cloud Apps
03-05-2024

Compose SDK - useGetDashboardModel include widgets

Hi,

Why i am not getting widgets info when using useGetDashboardModel({

    dashboardOid: <oid>,
    includeWidgets: true,
  }); ?

This is offficial Compose SDK hook which calls https://analytics.com/api/v1/dashboards/<oid>?expand=widgets&trc=sdk-ui-1.3.0 in the background.

Is there anything we need to include in the Dashboard settings to allow getting this info?

9 Replies

  • steve's avatar
    steve
    Sisense Employee

    Hi vladimir 

    The hook should work, providing there are widgets in the dashboard and the user has permission to see it.

    Can you check in the browser developer tools to see what is in the response the that API call? does the json include the dashboard metadata but the widgets are missing? is there any error?

    Here's a simple example of usage and expected output

    If you still have issues please log a support ticket to avoid potentially sharing sensitive information in the community, and we'll be happy to assist you further.

    Steve

     

    • vladimir's avatar
      vladimir
      Cloud Apps

      Yes, JSON includes the dashboard metadata but the widgets field is missing. 


      Might be permissions related problem.

      When i login in the Sisense admin tool i can see the dashboard with widgets. 

      Do you know which permissions should i have for the dashboard in order to be able to list the widgets in the API?

      • Liliia_DevX's avatar
        Liliia_DevX
        Sisense Employee

        vladimir hi!

        Please try to run the same API with the same user permissions in Sisense Swagger under the Admin tab -> REST API -> 1.0 -> GET/dashboards​/{id} and add the "widgets" attribute to the "expand" parameter: 

        Please let us know if that works in the native Sisense app. If the user you're using for the API execution has access to the dashboard (it's owned/shared with the user), the API should give you the data requested. 

        Best Regards, Lily 

  • steve's avatar
    steve
    Sisense Employee

    hi vladimir 

    If the issue was not already resolved, please could you try the newly released version of Compose SDK: 1.6.0 and see if it helps?

    We did identify some cases where widgets would not be returned if the dashboard contained widget types not supported natively by Compose SDK .. this was fixed in 1.6.0

    Hope this helps!

    Steve

    cc Liliia_DevX 

  • Hello vladimir,

    I wanted to follow up to see if the solution offered by steve or Liliia_DevX worked for you.

    If so, please click the 'Accept as Solution' button so that other users with the same questions can find the answer faster. If not, please let us know so that we can continue to help.

    Thank you.