Hey @Alexei, sorry to hear this is happening. Can you try removing height from the payload, and let me know if you can successfully send a request?
Hi @Addison Schultz, if only the width is sent I still get the error, if only the height is sent I get no error, response has new size, but card is not resized, (also tried closing and reopening board in case it was a refresh problem).
The card in question was manually resized. For a card that has not been manually resized the geometry commands work fine.
Manually changing colour or position does not affect ability to change those attributes via API, only geometry seems affected.
Hi @Alexei,
I tried to reproduce the issue you reported with both the Web SDK (I used a sample app and the browser developer console), and REST API (I used the REST API playground on the REST API developer docs site and Postman.)
This is what I did:
- Create a card with REST API/Web SDK.
- Resize it manually on the board UI.
- Update only the card geometry with REST API/Web SDK.
Expected result:
- The card on the board reflects the geometry update that was applied programmatically.
Actual result:
- The card on the board keeps the old geometry values. Geometry is not updated on the board UI after manually resizing the card.
I could not achieve your outcome. The steps I went through produced the expected result: the card geometry was updated successfully.
I'm opening a ticket on our end to ask the REST API team to investigate the issue more in depth.
Do you think you could share a screen recording video to help us better understand what could be causing the issue? This would give us some guidance as for what to look for.
I’ll do a screen recoding but here’s some further points:
There is two things I can do to manually change the size of a card:
- dragging the left edge changes the width, there is a minimum width and no apparent maximum. Dragging the bottom edge changes the height, there is a minimum height and a maximum height related to content (once all lines on title are exposed I can't increase height any more). So the aspect ratio is contained based on content.
- I can drag the corner of a card. This seems to scale a card and there are no limits on size.
So I can scale a card manually, then programatically attempt to set the width to 30, I get the error: ‘Value for width should be greater than or equal to 256.0, found: 68.61018854841734'.
If I manually scale the card down and try again to set width to 30 I get: 'Value for width should be greater than or equal to 256.0, found: 130.876884331362'
If I then scale the card down sufficiently and set the width to 30 It’s successful. The tool tip on the board reports a width of 30 as does the response.
There’s two things going on as far as I can see: firstly there are aspect ratio constraints to do with the content that limit the height values. Secondly there seems to be a hidden scale/units parameter that is not accessible programatically. i.e. constraints are being applied at a scale that can be changed manually but can't be accessed by the API, this is why the reported width found changes even though I’m always setting a width of 30.
To produce an error, create a card:
payload = {
'data':{'title':'Sample card'},
'geometry':{'width':300}
}
url = f"https://api.miro.com/v2/boards/uXjVPdveOFo=/cards"
response = requests.post(url, json=payload, headers=headers).json()
Manually tap on card to bring up handles and scale to twice the size. Now try and set the width to 300 which should be legal:
card_id = responsee'id']
payload = {
'geometry':{'width':300}
}
url = f"https://api.miro.com/v2/boards/uXjVPdveOFo=/cards/{card_id}"
response2 = requests.patch(url, json=payload, headers=headers).json()
I get the error
{'type': 'error', 'code': '3.0215', 'context': {'boardId': 'uXjVPdveOFo=', 'itemId': '3458764532060721253', 'validationErrors': E{'code': '3.0211', 'message': 'Value for width should be greater than or equal to 256.0, found: 150.80322771377394'}]}, 'message': 'Unable to complete operation because of the validation errors.', 'status': 400}
where the found value of 150 is half the requested width
Scale to 3 times the size and the result is:
{'type': 'error', 'code': '3.0215', 'context': {'boardId': 'uXjVPdveOFo=', 'itemId': '3458764532060721253', 'validationErrors': n{'code': '3.0211', 'message': 'Value for width should be greater than or equal to 256.0, found: 100.71525688814353'}]}, 'message': 'Unable to complete operation because of the validation errors.', 'status': 400}
which is a 1/3 of requested size etc.