Automate dashboard creation via REST API

Hello guys, 

 

Do anyone come cross api that would help to create new dashboard with widgets from existing dashboard or clone a exiting dashboard with its widgets? 

We are creating dashboad per release and we create dashboard then clone the widgets to the new dashboard, it is many manual steps and it is a pain. 

 

Any ideas? 

 

Thanks 

0
3 comments
Official comment

Hello Fayez,

here you can find the API for dashboards: https://www.jetbrains.com/help/hub/HUB-REST-API_Dashboards.html

The widgets are located in the `data` field: https://www.jetbrains.com/help/hub/HUB-REST-API_Dashboards_Create-New-Dashboard.html

Unfortunately, the part of the API concerning widgets is not documented yet, so I can suggest making some requests with the developer tools of your browser open and then imitate the same requests in your code.

Let us know if you need assistance, we'll be happy to help.

Hello, Liubov Dievskaia 

I am creating a new Dashboard according to https://www.jetbrains.com/help/hub/HUB-REST-API_Dashboards_Create-New-Dashboard.html.

Example:
-d '{
 "name": "4T",
 "owner": {
   "id": "230bbea5-78e0-4ce3-be5c-8bea6357f28c"
 },     

"data": {
   "widgets": [
     {
       "id": "youtrack-issues-list",
       "directive": "widget-custom",
       "grid": {
         "width": 2,
         "height": 2,
         "y": 0,
         "x": 2
       },
       "config": {
         "created": "2023-11-13T12:44:47.943Z",
         "customWidgetConfig": {
           "search": "commented by: me",
..............

The Dashboard is being created, but not for the user whose ID I'm passing in "owner": {
   "id": “230bbea5-78e0-4ce3-be5c-8bea6357f28c” }, 

but for the user under which I'm authorizing.
-H 'Authorization: Bearer perm:dmV0YXNzcw==.DjYrNzA=.hf5uWxneWEdVd0AGmmkmYVmLPQ00KA' 
How can I correctly pass the "owner" to create the Dashboard for a specific user?

Thank you!!!
PS: The token is fictional.

0

Hi Vitalii Bilchenko Pe!

This appears to be a bug. We've fixed it in the scope of this public issue: https://youtrack.jetbrains.com/issue/HUB-11578/Cant-create-dashboard-on-behalf-of-other-user. It'll be included in one of the upcoming releases. Feel free to follow the issue to get notified when it's released.

 

0

Please sign in to leave a comment.