Batch endpoints

  • 20 February 2023
  • 3 replies
  • 25 views

Badge +1

Hi all.

My case is - we render complex diagram with 1600 objects one the same board and other employees have read access. The board should be updated in some interval - every hour, for example.

My first issue - posting. I post all those 1k+ object one by one which is slow and not efficient from CPU POV for both sides - miro and my app side.  Maybe miro developers can provide batch endpoint to accept list of objects?

Next issue - recreating diagram, I can’t push only changes to the board, because logic would be super complex, because I’ll have to recalculate size of all elements, so it’s much easier for me to delete all and post everything again. My question is - How do I clean up the board with API? There is no such api right? 

I have to fetch all items by GET https://api.miro.com/v2/boards/{board_id}/items

and then delete them ONE BY ONE with

DELETE https://api.miro.com/v2/boards/{board_id}/items/{item_id}

Is that correct? That’s ridiculous isn’t it?

There should be batch endpoint for these operations, dont’ you think?

The board is the same, the link is the same, so please don’t propose to delete and create another board.


3 replies

Userlevel 2
Badge

Hey @Sergey Vorozhtsov ,

While it's not possible yet, it's something we're actively working on. We will be sharing more details on accessing an experimental/beta version of what we're referring to as bulk operations via API soon.

You can stay up to date with the capability on our public facing roadmap, here: https://portal.productboard.com/bs3msuyjdbfr8dfxd84wngpn/c/82-bulk-operations For now, however, you will need to make individual requests.

 

Regarding updating the board:
How are you handling the positioning now? If you are using the web SDK, one cool trick you could do is render the things you want in a normal HTML page (hidden in an iframe) and use getBoundingClientRect() to retrieve the coordinates for your items. Then it should be easy to update.

 

Clearing items should be easier if you just delete the frame and re-create the frame:

https://developers.miro.com/reference/delete-frame-item

 

Hope this works out for you, let me know otherwise.

 

Cheers,

Mettin

Badge +1

Items should have an id of a frame as a parentId to be deleted with the frame, right? This is not the case for now for our code, unfortunately, but maybe we’ll fix that on our side. I wasn’t able to set frame id as a parent id because I got response that child item is not within parent boundaries, despite the fact that it was fully inside, maybe there’re some invisible margins, I don’t know, but I don’t use parent Id for now.

How are you handling the positioning now?

I calculate them manually (which is a headache, but I already get used to it) and then push via API.

The problem with updating objects is that there’re not much space between objects, so if I need to make bigger first one, then I’ll have to move other object to the right, so they not overlap each other. Maybe I’ll check later what is SDK and if it solves our problem. 

Userlevel 2
Badge

Hey @Sergey Vorozhtsov ,

 

Were you able to solve the positioning issues with the SDK?

 

Cheers,
Mettin

Reply