Skip to main content

Hi, I’m referring to this command https://developers.miro.com/docs/interface-iboardwidgetscommands#section-update I’m currently using it with single id’s but since it says there is a option to call it with multiple id’s I’d like to utilize this, since I’m exepriencing board freeze / syncing with higher volumes of requests made to the API. I can’t see a example on how to utilize with for example a array of id’s.

 

What I have been using so far:

await miro.board.widgets.update({

                    "id" : widgetID2,

                    "clientVisible" : false

                })

 

Tried replacing my widgetID2 variable with a array but the API returned “Wrong argument passed to miro.board.widgets.update(widgets: {id: string; eindex: string]: any}m]).” 

 

I’m experiencing syncing times of up to 1 minute of the board when sending lets say 100 requests to the API to make 100 widgets invisible and want to prevent this ofcourse.

@Sami Ljimari 

Make an array around/of the full widget object(s) separated by commas. 
 

await miro.board.widgets.update(

   p

                {    "id" : widgetID1,

                    "clientVisible" : false

                },

                {    "id" : widgetID2,

                    "clientVisible" : false

                }

    ]

)
 

 

that should do the trick. 


@Max Harper 

Thanks for the response, I was thinking of how to execute this since I don’t know the id’s ahead of time and they are instead added by user when my app is running. I tried adding them in a loop into a JSON object like so:

JSONWidgetList = i...JSONWidgetList,{"id":widgetID, "clientVisible" : true}]

and call the method like so:

await miro.board.widgets.update({

        JSONWidgetList

    })

 

But still get the same error, any idea how I could achieve this when I don’t know the amount of widgets or their ID’s ahead of time?


My bad, it was a syntax issue on my side with extra pair of {} brackets, Thanks again Max, marking your comment as answer


.


Reply