Answered

Error: 'url' field is required for ImageWidget

  • 29 July 2021
  • 3 replies
  • 66 views

Userlevel 1
Badge +3

I’m currently trying to create images on a Miro board using the SDK. 

I have the images stored as base64 data URLs. But it seems the method isn’t accepting that format. 

Here the code I’m using: 

miro.board.widgets.create({
"type": "image",
"url": "data:image/png;base64,iVBORw0KGgoAA..."
})

The error message I get: 

Error: 'url' field is required for ImageWidget

Does the method only accept regular url’s? I wasn’t able to find an answer in the docs. 
 

icon

Best answer by Anthony Roux 2 August 2021, 12:16

View original

3 replies

Userlevel 4
Badge +6

Hi @Daniel Wirtz,

 

The current version of the SDK only supports Image widget creation from an existing URL (a hosted image). It does not support a base64 encoded image.

 

I will raise this requirement to the technical team to have it in our backlog.
 

 

Badge +2

Hi @Anthony Roux, it would also be great to be able to define image widgets via a “data:image/svg+xml” scheme/mime-type -- for small icon like images it would allow to avoid storing images in a server with an absolute url, allow to create/update images programmatically from the plugin etc. It would definitely be a highly valuable feature.

Userlevel 1
Badge +3

I thought this would be the only option. But if possible I would rather use the base64 encoded images, because then everything can stay inside the plugin and it’s more privacy friendly. 
 

Reply