inconsistent widgets API; web vs REST

  • 14 November 2021
  • 1 reply
  • 34 views

Hi,

 

I created small web plugin which created template on miro. But when I moved the same components so they are created by REST app I started getting errors in seemingly random places.

 

First issue

{
"type": "line",
"startPosition": {
"x": 0,
"y": 0
},
"endPosition": {
"x": 1000,
"y": 0
}
}
{
"status" : 400,
"code" : "invalidParameters",
"message" : "Method arguments are not valid",
"context" : {
"fields" : [ {
"field" : "",
"message" : "object has properties which are not allowed: [\"endPosition\",\"startPosition\"]",
"reason" : "invalidParameter"
}, {
"field" : "",
"message" : "object has missing required properties ([\"endWidget\",\"startWidget\"])",
"reason" : "invalidParameter"
} ]
},
"type" : "error"
}

 

I do not have widgets to attach this line to.

 

Second issue

{
"type": "shape",
"x": 0,
"y": 0,
"text": "Monday",
"width": 50,
"height": 50,
"style": {
"borderWidth": 2,
"backgroundColor": "#B2EEE4"
}
}
{
"status" : 400,
"code" : "invalidParameters",
"message" : "Method arguments are not valid",
"context" : {
"fields" : [ {
"field" : "style.borderWidth",
"message" : "value (0) not found in enum (possible values: [2,4,8,16,24])",
"reason" : "invalidParameter"
} ]
},
"type" : "error"
}

Why I cannot have borders with 0 width?

Third issue

{
"type": "text",
"x": -37,
"y": 0,
"text": "uno",
"width": 100,
"rotation": 270,
"style": {
"fontSize": 12,
"textColor": "#B2EEE4",
"textAlign": "c"
}
}
{
"status" : 400,
"code" : "invalidParameters",
"message" : "Method arguments are not valid",
"context" : {
"fields" : [ {
"field" : "style.textAlign",
"message" : "value (\"c\") not found in enum (possible values: [\"center\",\"right\",\"left\"])",
"reason" : "invalidParameter"
} ]
},
"type" : "error"
}

 

 

I literally had three different (in my opinion simple) type of components and I got three different errors.

 

Fourth issue

This may be question. I tried to use capability: {editable: false} but I was still able to change widget as user. To my knowledge this has no relation to locking, and locking is not available via api.


---

Also why https://developers.miro.com/reference/create-board-widgets wont allow passing list as argument? Performance impact should be the same as using it in browser via plugin api. 

There are others differences like no tags support but those are at least documented.


my apologies if message is a bit aggressive but I’m trying to build something under time pressure and those surprises are not helping :(

 

Thanks


1 reply

Userlevel 4
Badge

Hi @Ireneusz Kozlowski,

 

Thanks for taking the time to share this detail feedback.

Before answering to them one by one, as of today we do not offer the same functionality between our REST API and our Web SDK. We are planning on releasing new features so both components are more consistent but we will always have some differences as some things might only be possible on the frontend side or the backend side.

 

Issue #1

In the current version of the REST API, Lines work only to connect 2 widgets.

 

Issue #2

I raised this to the API team, I believe this is an issue on our side and it should be possible with the REST API. I will let you know when I have more information.

 

Issue #3

You are right, this is an inconsistency between the REST API and the Web SDK. In the REST API the values for textAlign are: "center", "right", "left" 

 

Issue #4

capability: {editable: false} should disable the possibility of changing any property of the widget (basically the widget context menu). From what I tested it works except for the text of the widget that I can still edit (even though it does not show the caret). I have raised this to the technical team and will let you know when I hear from them. 

Reply