Batch endpoints


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.


11 replies

Userlevel 3
Badge +1

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

Userlevel 6
Badge +4

Hey @Sergey Vorozhtsov,

Thanks for raising this feedback, and can certainly appreciate these pain points you’ve raised. As Mettin mentioned, we’re actively working on endpoints to handle batch operations (including deletion), which should help drastically improve this experience. But some good news—we hope to have an update on this functionality in the next few weeks. 😄

In the meantime, I’m afraid these requests by REST API are only supported on an individual item level, and only items of type `frame` support the parent/child relationship at the moment. We’re hoping to expand on this in the future. 

Having said all this, I hear you on how this could be made easier. Perhaps an endpoint such as “Clear Board Items (All)” or similar would be the most direct solution here. I’ve gone ahead and shared this feedback with our product team internally, and will be happy to keep you abreast of any updates on this. 

Badge +1

Hey @Mettin , I checked the documentation and I don’t know how to use it for my use case. I have java service that fetch data and update it in miro, but sdk is something different.

Badge +1

I still have a problem to update \ delete content of the board and as I can see some ridiculous issues were fixed like shape can’t be a parent for card or smth like that. So I thought that I can create frame, add some shapes and card with parentid = frameid. And then when I’d like to delete \ modify the content I’d just delete root object by id - my frame. By doing this I’d not do removal all thousands of objects one by one (batch endpoints - topic of this thread) - but I’d remove all by single api call.

BUT it doesn’t work. Parent removal only remove parent object and that’s it.

And btw parent field is not present in the response from EP:
GET https://api.miro.com/v2/boards/{board_id}/items

So I don’t really understand what is Parent field for?

Badge +1

Still one more issue with parent:

feign.FeignException$BadRequest: [400 Bad Request] during [POST] to [https://api.miro.com/v2/boards/uXjVPnLlkiQ%3D/shapes] [MiroClient#postShape(String,Shape)]: [{
  "type" : "error",
  "code" : "badRequest",
  "message" : "wrong parent type SHAPE",
  "status" : 400
}]

Why shape can’t be parent of a shape? why anything can’t be parent of anything?

Badge

Hi @William Bishop,

are there any news regarding the bulk interfaces. I’ve seen the experimental part for creating items. but i miss this functionality for deleting items. I create a lot of sticky notes automatically. For an update I delete first all of them and create the content new. The deletion really takes a long time while sending for each a single request. It would also be helpful for me if i could delete a frame and then all children would be deleted automatically.

Best Regards

Martin

Userlevel 2
Badge +1

Hi @Martin Finke thanks for the feedback!
At the moment we don’t have any updates around this, but I’ve logged your feature requests with the team and we will follow up once we have more information about the bulk API roadmap.

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. 

Badge +1

Thanks for the answer. This ep to clean up the board would be great, but unfortunately our users would like to not loose their data from the board, so I’d like to have an option to delete all items that were created automatically and to not touch all the others created by people.

I think I saw some tagging and it might help me, but still I’ll have to iterate all items if deletion by parent object is not supported.

Userlevel 6
Badge +4

Thanks for the context, @Sergey Vorozhtsov — can definitely appreciate the use case here. As you mentioned, tags could be one workaround for the moment, as you could append some kind of “automation” label to items such as stickies, for example. You may also find the use of webhooks or the events in our SDK helpful for listening when items are originally created — this could help to understand which items were created via automation (if you were running a regular sync job at a given time, for instance). 

But having said that, I fully appreciate this isn’t a comprehensive solution in this case.

I’m happy to share this feedback and advocate for a solution, and will also keep this thread open so that we can circle back on the release of Bulk Operations via REST API for you once they’re available — this should hopefully significantly reduce the number of requests you’ll need to make to our API. :) 

Thanks, and I’ll be in touch,
Will

Userlevel 3
Badge +1

Hey @Sergey Vorozhtsov ,

 

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

 

Cheers,
Mettin

Reply