Inconsistency of position object in v2 REST API

  • 7 November 2022
  • 2 replies
  • 50 views

Userlevel 2
Badge +2

When I read a sticky note that is inside an Frame with the v2.0 REST API, the position object contains a “relative_to”:”parent_top_left” value.  While this can be helpful, the “relative_to” field is not documented in the position object documentation.  Additionally, when trying to add a new sticky in relation to the previous one I read, if I use the “relative_to” field, I get the message "Field [position.relativeTo] is not supported".  If I get the frame, it returns a positions “relative_to”:”canvas_center”.  In order to read a sticky and position another one relative to it, I have to get its parent, determine it’s width and height, calculate the top left position, calculate the sticky’s position relative to that, then position my new sticky relative to canvas_center (although without specifying that).

 

Having things you read be relative to something different than what you write is very awkward.  It would also be helpful if the documentation could explain this instead of having to find out by experimentation.


2 replies

Userlevel 5

Hi Steve, 

 

I think the relative_to key that is returned isn’t something that we’ve meant to expose - given the reason it is not documented. 

If you’d like to know more about positioning items inside/outside a Frame, have you seen this article? 

https://developers.miro.com/docs/boards#position-relative-to-parent-items

Userlevel 2
Badge +2

Thank you.  I had incorrectly assumed that if I got an item and the position object had a relative_to key, that I should include a similar key when adding a new item that was a child of the same frame.  I removed that key and it worked as expected.

Reply